debug: log all continue statements in goal deviation calculation
All checks were successful
Deploy Development / deploy (push) Successful in 45s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s

- Log when using created_at as fallback for start_date
- Log when skipping due to missing created_at
- Log when skipping due to invalid date range (total_days <= 0)

This will reveal exactly why Körperfett and Zielgewicht are not added.
This commit is contained in:
Lars 2026-03-28 15:09:41 +01:00
parent 294b3b2ece
commit eb8b503faa

View File

@ -867,7 +867,9 @@ def _format_goals_behind(profile_id: str, n: int = 3) -> str:
created_at = g.get('created_at')
if created_at:
start_dt = date.fromisoformat(str(created_at).split('T')[0])
print(f"[DEBUG] → Using created_at as start_date: {start_dt}")
else:
print(f"[DEBUG] → Skipped: No start_date and no created_at")
continue # Can't calculate without start date
target_dt = target_date if isinstance(target_date, date) else date.fromisoformat(str(target_date))
@ -877,6 +879,7 @@ def _format_goals_behind(profile_id: str, n: int = 3) -> str:
elapsed_days = (today - start_dt).days
if total_days <= 0:
print(f"[DEBUG] → Skipped: Invalid date range (total_days={total_days})")
continue # Invalid date range
expected_progress_pct = (elapsed_days / total_days) * 100