Spaces:
Runtime error
Runtime error
Update app.py
Browse files120 unmodified lines12112212312412412512612712817 unmodified lines146147148148149150151152153154155156157158159160161162163164165166167168149150151152153154155156157158159160161162163164165120 unmodified lines pages = response.json().get('results', []) # Create a dictionary for the latest update time of each branch latest_updates = {branch['Name']: branch.get('updated', '') for branch in branch_data} branch_details = {branch['Name']: {'updated': branch.get('updated', ''), 'commit_message': branch.get('commit_message', '')} for branch in branch_data}
# Status color mapping status_colors = {17 unmodified lines existing_depends_on = [dep['name'] for dep in page['properties'].get('depends-on', {}).get('multi_select', [])] break # Determine status based on dependencies latest_update = latest_updates.get(branch['Name'], '') outdated = False if 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 comparison latest_update = latest_updates.get(branch_name, '') if branch_name in latest_updates and latest_updates[branch_name] > latest_update: outdated = True break if not latest_update: status_tag = "empty" elif outdated: status_tag = "outdated" else: status_tag = "up-to-date" # Determine status based on dependencies status_tag = "up-to-date" # Default status for 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 page print (branch.get("url", ""))app.py+16-22