Cleanup after initial plan
This commit is contained in:
parent
d2a7e652b3
commit
245520fb50
53 changed files with 6733 additions and 621 deletions
|
|
@ -114,7 +114,7 @@ export class MealPlanService {
|
|||
|
||||
/** Calculates standard daily totals based on the component meals. */
|
||||
private computeDayTotals(day: MealPlanDay): MealPlanDay {
|
||||
const total: NutritionInfo = {
|
||||
const total = {
|
||||
calories: 0,
|
||||
protein: 0,
|
||||
carbs: 0,
|
||||
|
|
@ -136,14 +136,14 @@ export class MealPlanService {
|
|||
total.carbs += source.carbs * servings;
|
||||
total.fat += source.fat * servings;
|
||||
|
||||
if (source.fiber != null) total.fiber = (total.fiber ?? 0) + source.fiber * servings;
|
||||
if (source.sugar != null) total.sugar = (total.sugar ?? 0) + source.sugar * servings;
|
||||
if (source.sodium != null) total.sodium = (total.sodium ?? 0) + source.sodium * servings;
|
||||
if (source.fiber != null) total.fiber += source.fiber * servings;
|
||||
if (source.sugar != null) total.sugar += source.sugar * servings;
|
||||
if (source.sodium != null) total.sodium += source.sodium * servings;
|
||||
if (source.saturatedFat != null) {
|
||||
total.saturatedFat = (total.saturatedFat ?? 0) + source.saturatedFat * servings;
|
||||
total.saturatedFat += source.saturatedFat * servings;
|
||||
}
|
||||
if (source.cholesterol != null) {
|
||||
total.cholesterol = (total.cholesterol ?? 0) + source.cholesterol * servings;
|
||||
total.cholesterol += source.cholesterol * servings;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -155,11 +155,11 @@ export class MealPlanService {
|
|||
protein: Math.round(total.protein * 100) / 100,
|
||||
carbs: Math.round(total.carbs * 100) / 100,
|
||||
fat: Math.round(total.fat * 100) / 100,
|
||||
fiber: Math.round((total.fiber ?? 0) * 100) / 100,
|
||||
sugar: Math.round((total.sugar ?? 0) * 100) / 100,
|
||||
sodium: Math.round((total.sodium ?? 0) * 100) / 100,
|
||||
saturatedFat: Math.round((total.saturatedFat ?? 0) * 100) / 100,
|
||||
cholesterol: Math.round((total.cholesterol ?? 0) * 100) / 100,
|
||||
fiber: Math.round(total.fiber * 100) / 100,
|
||||
sugar: Math.round(total.sugar * 100) / 100,
|
||||
sodium: Math.round(total.sodium * 100) / 100,
|
||||
saturatedFat: Math.round(total.saturatedFat * 100) / 100,
|
||||
cholesterol: Math.round(total.cholesterol * 100) / 100,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue