Spaces:
Runtime error
Runtime error
Update app.py
Browse files120 unmodified lines12112212312412512612717 unmodified lines145146147148149150151152153154155156157158159160161162163164165166167168169170171120 unmodified linespages = response.json().get('results', [])# Create a dictionary for the latest update time of each branchlatest_updates = {branch['Name']: branch.get('updated', '') for branch in branch_data}# Status color mappingstatus_colors = {17 unmodified linesexisting_depends_on = [dep['name'] for dep in page['properties'].get('depends-on', {}).get('multi_select', [])]break# Determine status based on dependencieslatest_update = latest_updates.get(branch['Name'], '')outdated = Falseif existing_depends_on:for branch in branch_data:branch_name = branch['Name']if branch_name in existing_depends_on:# Check if 'commit_message' exists and contains 'isConnected'commit_message = branch.get("commit_message", "")if "isConnected" not in commit_message:# Additional check for the latest update comparisonlatest_update = latest_updates.get(branch_name, '')if branch_name in latest_updates and latest_updates[branch_name] > latest_update:outdated = Truebreakif not latest_update:status_tag = "empty"elif outdated:status_tag = "outdated"else:status_tag = "up-to-date"# Prepare data for updating or creating a pageprint (branch.get("url", ""))120 unmodified lines12112212312412512612712817 unmodified lines146147148149150151152153154155156157158159160161162163164165120 unmodified linespages = response.json().get('results', [])# Create a dictionary for the latest update time of each branchbranch_details = {branch['Name']: {'updated': branch.get('updated', ''), 'commit_message': branch.get('commit_message', '')} for branch in branch_data}# Status color mappingstatus_colors = {17 unmodified linesexisting_depends_on = [dep['name'] for dep in page['properties'].get('depends-on', {}).get('multi_select', [])]break# Determine status based on dependenciesstatus_tag = "up-to-date" # Default statusfor dependency_name in existing_depends_on:dependency_info = branch_details.get(dependency_name, {})branch_update_time = branch_details.get(branch['Name'], {}).get('updated', '')# Check if the dependency is more recent and if its commit message does not contain 'isConnected'if dependency_info.get('updated', '') > branch_update_time and "isConnected" not in dependency_info.get('commit_message', ''):status_tag = "outdated"break# If there's no update information, set status to 'empty'if not branch_update_time:status_tag = "empty""# Prepare data for updating or creating a pageprint (branch.get("url", ""))
app.py+16-22