feat(weekplan): MIKRO WEEK-2 dagliga måltidsslots (vardag middag, helg lunch+middag)

This commit is contained in:
Sven (AAMOS AI)
2026-08-17 19:17:27 +07:00
parent 9777c2ff1b
commit 97b5baa367
3 changed files with 10 additions and 2 deletions
+3 -1
View File
@@ -18,6 +18,7 @@ interface WeekPlanJobInput {
weekStartDate: string;
daysToPlann?: number;
mealTypes: MealType[];
mealSlots?: MealType[][];
portionsPerMeal?: number;
budgetMinorTotal?: number;
preferLeftoversFirst: boolean;
@@ -228,7 +229,8 @@ export async function processGenerateWeekPlan(
const date = new Date(Date.parse(data.input.weekStartDate) + day * 86_400_000)
.toISOString()
.slice(0, 10);
for (const mealType of mealTypes) {
const dayMeals = data.input.mealSlots ? (data.input.mealSlots[day] ?? []) : mealTypes;
for (const mealType of dayMeals) {
// Matlåda om det finns och portionerna räcker
const box = mealBoxes[boxIndex];
if (box && box.portionsRemaining >= Math.min(portions, 2)) {