fix: add start_date and created_at to get_active_goals query
All checks were successful
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s

ROOT CAUSE: get_active_goals() SELECT was missing start_date and created_at
IMPACT: Time-based deviation calculation failed silently for all goals

Now returns:
- start_date: Required for accurate time-based progress calculation
- created_at: Fallback when start_date is not set

This fixes:
- Zielgewicht (weight) should now show +7% ahead
- Körperfett should show time deviation
- All goals with target_date now have time-based tracking
This commit is contained in:
Lars 2026-03-28 17:18:53 +01:00
parent eb8b503faa
commit 0e89850df8

View File

@ -542,7 +542,8 @@ def get_active_goals(profile_id: str) -> List[Dict]:
cur = get_cursor(conn)
cur.execute("""
SELECT id, goal_type, name, target_value, target_date,
current_value, start_value, progress_pct, status, is_primary
current_value, start_value, start_date, progress_pct,
status, is_primary, created_at
FROM goals
WHERE profile_id = %s
AND status IN ('active', 'in_progress')