fix: compute macro targets dynamically from protein goal and body weight

Fat/carb percentages were stored as absolute values that didn't account
for protein g/kg varying with body weight. Now protein calories are
computed first, and remaining calories are split between fat and carbs
by their stored ratio — guaranteeing all macros sum to the calorie goal.

Exercise burned calories also flow into fat/carb targets via a new
effectiveCalorieGoal derived. Goal editor ring preview and labels
updated to show computed actual percentages.
This commit is contained in:
2026-04-10 08:01:00 +02:00
parent 208c630bca
commit 07fefb1bde
4 changed files with 89 additions and 35 deletions
+2 -2
View File
@@ -282,8 +282,8 @@ const translations: Translations = {
protein_goal: { en: 'Protein goal', de: 'Proteinziel' },
protein_fixed: { en: 'Fixed (g/day)', de: 'Fest (g/Tag)' },
protein_per_kg: { en: 'Per kg bodyweight', de: 'Pro kg Körpergewicht' },
fat_percent: { en: 'Fat (%)', de: 'Fett (%)' },
carb_percent: { en: 'Carbs (%)', de: 'Kohlenhydrate (%)' },
fat_percent: { en: 'Fat ratio', de: 'Fett-Anteil' },
carb_percent: { en: 'Carbs ratio', de: 'KH-Anteil' },
kcal: { en: 'kcal', de: 'kcal' },
protein: { en: 'Protein', de: 'Protein' },
fat: { en: 'Fat', de: 'Fett' },