fix: Graceful fallback if Migration 031 not yet applied
- Wrap focus_contributions loading in try/catch - If tables don't exist (migration not run), continue without them - Backward compatible with pre-migration state - Logs warning but doesn't crash
This commit is contained in:
parent
34ea51b8bd
commit
ba5d460e92
|
|
@ -720,6 +720,7 @@ def get_goals_grouped(session: dict = Depends(require_auth)):
|
|||
focus_map = {} # goal_id → [contributions]
|
||||
|
||||
if goal_ids:
|
||||
try:
|
||||
placeholders = ','.join(['%s'] * len(goal_ids))
|
||||
cur.execute(f"""
|
||||
SELECT
|
||||
|
|
@ -743,6 +744,10 @@ def get_goals_grouped(session: dict = Depends(require_auth)):
|
|||
'category': row['category'],
|
||||
'contribution_weight': float(row['contribution_weight'])
|
||||
})
|
||||
except Exception as e:
|
||||
# Migration 031 not yet applied - focus_contributions tables don't exist
|
||||
print(f"[WARNING] Could not load focus_contributions: {e}")
|
||||
# Continue without focus_contributions (backward compatible)
|
||||
|
||||
# Group by category and attach focus_contributions
|
||||
grouped = {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user