Reorganise the views and prepare summary
All checks were successful
Build and Deploy / build-and-push (push) Successful in 23s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 23s
This commit is contained in:
@@ -5,7 +5,9 @@ import { getDayPlan } from './planStore.js';
|
||||
|
||||
export function dayHasAnyMeal(plans, d) {
|
||||
const p = getDayPlan(plans, d);
|
||||
const skipped = p._skipped || {};
|
||||
return MEAL_SLOTS.some((s) => {
|
||||
if (skipped[s.id]) return false;
|
||||
const arr = p[s.id];
|
||||
return Array.isArray(arr) && arr.length > 0;
|
||||
});
|
||||
@@ -17,7 +19,9 @@ export function sumDayNutrition(dayPlan) {
|
||||
let fat = 0;
|
||||
let carbs = 0;
|
||||
let mealCount = 0;
|
||||
const skipped = dayPlan._skipped || {};
|
||||
MEAL_SLOTS.forEach((slot) => {
|
||||
if (skipped[slot.id]) return;
|
||||
const entries = dayPlan[slot.id];
|
||||
if (!Array.isArray(entries)) return;
|
||||
entries.forEach((entry) => {
|
||||
@@ -56,7 +60,9 @@ function resolveLine(ing, scaledAmount) {
|
||||
export function flattenDayIngredientLines(dayPlan) {
|
||||
/** @type {ReturnType<typeof resolveLine>[]} */
|
||||
const out = [];
|
||||
const skipped = dayPlan._skipped || {};
|
||||
MEAL_SLOTS.forEach((slot) => {
|
||||
if (skipped[slot.id]) return;
|
||||
const entries = dayPlan[slot.id];
|
||||
if (!Array.isArray(entries)) return;
|
||||
entries.forEach((entry) => {
|
||||
@@ -112,7 +118,9 @@ export function aggregateWeekIngredientNeed(plans, weekStart) {
|
||||
export function aggregateDayIngredientsBySlot(dayPlan) {
|
||||
/** @type {{ mealLabel: string, recipes: { recipeTitle: string, items: { ingredientId: string, name: string, amount: number, unit: string, category: string }[] }[] }[]} */
|
||||
const blocks = [];
|
||||
const skipped = dayPlan._skipped || {};
|
||||
MEAL_SLOTS.forEach((slot) => {
|
||||
if (skipped[slot.id]) return;
|
||||
const entries = dayPlan[slot.id];
|
||||
if (!Array.isArray(entries) || entries.length === 0) return;
|
||||
const recipes = [];
|
||||
|
||||
Reference in New Issue
Block a user