debug: add detailed logging to get_nutrition_avg
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 14s

This commit is contained in:
Lars 2026-03-28 21:00:14 +01:00
parent 285184ba89
commit a441537dca

View File

@ -112,8 +112,10 @@ def get_nutrition_avg(profile_id: str, field: str, days: int = 30) -> str:
This function now only FORMATS the data for AI consumption.
"""
data = get_nutrition_average_data(profile_id, days)
print(f"[DEBUG] get_nutrition_average_data returned: {data}")
if data['confidence'] == 'insufficient':
print(f"[DEBUG] Confidence is insufficient, returning 'nicht verfügbar'")
return "nicht verfügbar"
# Map field names to data keys
@ -125,6 +127,7 @@ def get_nutrition_avg(profile_id: str, field: str, days: int = 30) -> str:
}
data_key = field_map.get(field, f'{field}_avg')
value = data.get(data_key, 0)
print(f"[DEBUG] field={field}, data_key={data_key}, value={value}")
if field == 'kcal':
return f"{int(value)} kcal/Tag (Ø {days} Tage)"