From 0e89850df87bdc3f917f6a6feaf5eb043287b825 Mon Sep 17 00:00:00 2001 From: Lars Date: Sat, 28 Mar 2026 17:18:53 +0100 Subject: [PATCH] fix: add start_date and created_at to get_active_goals query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- backend/goal_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/goal_utils.py b/backend/goal_utils.py index 2adc14b..5316993 100644 --- a/backend/goal_utils.py +++ b/backend/goal_utils.py @@ -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')