fix charts

This commit is contained in:
2026-06-18 08:27:29 +00:00
parent 70910b82d2
commit b4cc07b9f8
57 changed files with 371 additions and 37 deletions
+7
View File
@@ -20,6 +20,7 @@ PROTEIN_G_PER_KG = {
"gain": 1.8,
}
FAT_G_PER_KG = 1.0
FIBER_G_PER_1000_KCAL = 14
EXPECTED_LOOKBACK_DAYS = 7
EXPECTED_MIN_DAYS_WITH_DATA = 3
@@ -64,6 +65,10 @@ def water_target_l(weight_kg: float) -> float:
return round(weight_kg * WATER_ML_PER_KG / 1000, 1)
def fiber_target(calorie_target: float) -> float:
return round(calorie_target / 1000 * FIBER_G_PER_1000_KCAL, 0)
def macro_targets(
calorie_target: float,
weight_kg: float,
@@ -133,6 +138,7 @@ def compute_daily_targets(
"protein_g": macros["protein_g"],
"fat_g": macros["fat_g"],
"carbs_g": macros["carbs_g"],
"fiber_g": fiber_target(calorie_target),
"water_l": water,
"bmi": round(bmi(weight, height), 1),
"steps": steps_total,
@@ -145,6 +151,7 @@ def targets_to_api(daily: dict[str, Any]) -> dict[str, float]:
"protein_g": daily["protein_g"],
"fat_g": daily["fat_g"],
"carbs_g": daily["carbs_g"],
"fiber_g": daily["fiber_g"],
"water_ml": round(daily["water_l"] * 1000),
}