fix: E2 protein-adequacy endpoint - undefined variable 'values' -> 'daily_values'
All checks were successful
Deploy Development / deploy (push) Successful in 50s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 14s

This commit is contained in:
Lars 2026-03-29 07:38:04 +02:00
parent 56273795a0
commit c21a624a50

View File

@ -688,7 +688,7 @@ def get_protein_adequacy_chart(
confidence = calculate_confidence(len(rows), days, "general")
# Count days in target
days_in_target = sum(1 for v in values if target_low <= v <= target_high)
days_in_target = sum(1 for v in daily_values if target_low <= v <= target_high)
return {
"chart_type": "line",
@ -702,7 +702,7 @@ def get_protein_adequacy_chart(
"target_low": round(target_low, 1),
"target_high": round(target_high, 1),
"days_in_target": days_in_target,
"target_compliance_pct": round(days_in_target / len(values) * 100, 1) if values else 0,
"target_compliance_pct": round(days_in_target / len(daily_values) * 100, 1) if daily_values else 0,
"first_date": rows[0]['date'],
"last_date": rows[-1]['date']
})