diff --git a/backend/calculations/nutrition_metrics.py b/backend/calculations/nutrition_metrics.py index 84735a8..8ee66d0 100644 --- a/backend/calculations/nutrition_metrics.py +++ b/backend/calculations/nutrition_metrics.py @@ -59,7 +59,7 @@ def calculate_energy_balance_7d(profile_id: str) -> Optional[float]: # Simple TDEE estimate: bodyweight (kg) × 30-35 # TODO: Improve with activity level, age, gender - estimated_tdee = weight_row['weight'] * 32.5 + estimated_tdee = float(weight_row['weight']) * 32.5 balance = avg_intake - estimated_tdee @@ -106,7 +106,7 @@ def calculate_protein_g_per_kg(profile_id: str) -> Optional[float]: if not weight_row: return None - weight = weight_row['weight'] + weight = float(weight_row['weight']) # Get protein intake cur.execute(""" @@ -150,7 +150,7 @@ def calculate_protein_days_in_target(profile_id: str, target_low: float = 1.6, t if not weight_row: return None - weight = weight_row['weight'] + weight = float(weight_row['weight']) # Get protein intake last 7 days cur.execute(""" @@ -199,7 +199,7 @@ def calculate_protein_adequacy_28d(profile_id: str) -> Optional[int]: if not weight_row or not weight_row['avg_weight']: return None - weight = weight_row['avg_weight'] + weight = float(weight_row['avg_weight']) # Get protein intake (28d) cur.execute("""