fix: E2 protein-adequacy endpoint - undefined variable 'values' -> 'daily_values'
This commit is contained in:
parent
56273795a0
commit
c21a624a50
|
|
@ -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']
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user