reglas: plato fijo por dia y comida (ej. tortilla los viernes de cena)

- Dish.fixedDayOfWeek/fixedMealType (opcionales, aditivos para CloudKit)
- Toggle + pickers de dia/comida en el formulario de plato
- AutocompleteEngine: pre-pasada que asigna los platos fijos a su hueco
  antes del bucle MRV, de modo que cuentan para el resto de reglas
- Evento analytics dish_fixed_slot_set; strings en 6 idiomas

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013H6bXqGX1ygwib1Dm3n3UG
This commit is contained in:
alexandrev-tibco
2026-09-01 11:22:34 +02:00
parent 47daab9e51
commit 7193234024
10 changed files with 120 additions and 2 deletions
@@ -33,6 +33,18 @@ struct AutocompleteEngine {
var unfilledCount = 0
var pendingSlots = emptySlots.filter { !$0.isEatingOut }
// Fixed-slot rules win outright: a dish pinned to a weekday+meal fills
// that slot before any scoring. Runs before the MRV loop so the pinned
// dish also counts against no-repeat/tag rules for the rest of the week.
for slot in pendingSlots {
guard let fixed = allDishes.first(where: {
$0.fixedDayOfWeek == slot.dayOfWeek && $0.fixedMealType == slot.mealType
}) else { continue }
slot.dishId = fixed.id
filledSlots.append((slotId: slot.id, dishId: fixed.id))
}
pendingSlots.removeAll { $0.dishId != nil }
// MRV: at each step pick the slot with fewest valid candidates first.
// Assignments update currentPlan.slotList in-place, so subsequent candidate
// counts automatically reflect the growing set of committed dishes.