docs: cleanup debug logs + document goal system enhancements
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s

- Removed all debug print statements from placeholder_resolver.py
- Removed debug print statements from goals.py (list_goals, update_goal)
- Updated CLAUDE.md with Phase 0a completion details:
  * Auto-population of start_date/start_value from historical data
  * Time-based tracking (behind schedule = time-deviated)
  * Hybrid goal display (with/without target_date)
  * Timeline visualization in goal lists
  * 7 bug fixes documented
- Created memory file for future sessions (feedback_goal_system.md)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 4.6 committed 2026-03-28 17:32:13 +01:00
1 parent dd395180a3
commit 255d1d61c5
3 files changed
+39 -54

No files matched your search

-28
View File
@@ -360,12 +360,10 @@ def list_goals(session: dict = Depends(require_auth)):
""", (pid,))
goals = [r2d(row) for row in cur.fetchall()]
print(f"[DEBUG] Loaded {len(goals)} goals for profile {pid}")
# Debug: Show first goal with dates
if goals:
first = goals[0]
print(f"[DEBUG] First goal dates: start_date={first.get('start_date')} (type: {type(first.get('start_date'))}), target_date={first.get('target_date')} (type: {type(first.get('target_date'))})")
# Update current values for each goal
for goal in goals:
@@ -378,11 +376,6 @@ def list_goals(session: dict = Depends(require_auth)):
# Serialize date objects to ISO format strings
goals = serialize_dates(goals)
# Debug: Show ALL goals with their dates
print(f"[DEBUG] Returning {len(goals)} goals after serialization:")
for g in goals:
print(f" Goal {g.get('id')}: goal_type={g.get('goal_type')}, start_date={g.get('start_date')}, target_date={g.get('target_date')}")
return goals
except Exception as e:
@@ -469,14 +462,6 @@ def update_goal(goal_id: str, data: GoalUpdate, session: dict = Depends(require_
"""Update existing goal"""
pid = session['profile_id']
# Debug logging
print(f"[DEBUG] update_goal called with:")
print(f" goal_id: {goal_id}")
print(f" start_date: {data.start_date} (type: {type(data.start_date)})")
print(f" start_value: {data.start_value}")
print(f" target_date: {data.target_date}")
print(f" target_value: {data.target_value}")
with get_db() as conn:
cur = get_cursor(conn)
@@ -549,9 +534,7 @@ def update_goal(goal_id: str, data: GoalUpdate, session: dict = Depends(require_
goal_row = cur.fetchone()
if goal_row:
goal_type = goal_row['goal_type']
print(f"[DEBUG] Looking up historical value for {goal_type} on or after {requested_date}")
historical_data = _get_historical_value_for_goal_type(conn, pid, goal_type, requested_date)
print(f"[DEBUG] Historical data result: {historical_data}")
if historical_data is not None:
# Use actual measurement date and value
@@ -607,8 +590,6 @@ def update_goal(goal_id: str, data: GoalUpdate, session: dict = Depends(require_
params.extend([goal_id, pid])
update_sql = f"UPDATE goals SET {', '.join(updates)} WHERE id = %s AND profile_id = %s"
print(f"[DEBUG] UPDATE SQL: {update_sql}")
print(f"[DEBUG] UPDATE params: {params}")
cur.execute(update_sql, tuple(params))
@@ -618,7 +599,6 @@ def update_goal(goal_id: str, data: GoalUpdate, session: dict = Depends(require_
FROM goals WHERE id = %s
""", (goal_id,))
saved_goal = cur.fetchone()
print(f"[DEBUG] After UPDATE, goal in DB: {r2d(saved_goal)}")
return {"message": "Ziel aktualisiert"}
@@ -768,16 +748,13 @@ def _get_historical_value_for_goal_type(conn, profile_id: str, goal_type: str, t
# Get goal type configuration
config = get_goal_type_config(conn, goal_type)
if not config:
print(f"[DEBUG] No config found for goal_type: {goal_type}")
return None
source_table = config.get('source_table')
source_column = config.get('source_column')
print(f"[DEBUG] Config: table={source_table}, column={source_column}")
if not source_table or not source_column:
print(f"[DEBUG] Missing source_table or source_column")
return None
# Query for value closest to target_date (±7 days window)
@@ -803,13 +780,10 @@ def _get_historical_value_for_goal_type(conn, profile_id: str, goal_type: str, t
"""
params = (profile_id, target_date)
print(f"[DEBUG] Query: {query}")
print(f"[DEBUG] Params: {params}")
cur.execute(query, params)
row = cur.fetchone()
print(f"[DEBUG] Query result: {row}")
if row:
value = row[source_column]
@@ -827,10 +801,8 @@ def _get_historical_value_for_goal_type(conn, profile_id: str, goal_type: str, t
result_date = measurement_date
result = {'value': result_value, 'date': result_date}
print(f"[DEBUG] Returning: {result}")
return result
print(f"[DEBUG] No data found on or after {target_date}")
return None
except Exception as e:
print(f"[ERROR] Failed to get historical value for {goal_type} on {target_date}: {e}")