feat(weekplan): MIKRO WEEK-2 dagliga måltidsslots (vardag middag, helg lunch+middag)
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user