platos: segundo plato por comida (ensalada + salmon)
- MealSlot.secondaryDishId (opcional, aditivo CloudKit); se limpia al sustituir/quitar/vaciar/marcar comer fuera y viaja en swaps, copia de semana anterior, undo y snapshot KV de iCloud (retrocompatible) - Picker de hueco lleno: toggle "anadir como segundo plato" + boton para quitarlo; HomeViewModel.assignSecondaryDish/removeSecondaryDish - Se muestra "Plato + Segundo" en calendario, widget y export; la lista de la compra incluye los ingredientes del segundo; stats lo cuentan - Evento analytics secondary_dish_added; 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:
@@ -172,6 +172,7 @@ struct StatsView: View {
|
||||
for plan in weekPlans {
|
||||
for slot in plan.slotList {
|
||||
if let id = slot.dishId { counts[id, default: 0] += 1 }
|
||||
if let id = slot.secondaryDishId { counts[id, default: 0] += 1 }
|
||||
}
|
||||
}
|
||||
return counts
|
||||
@@ -197,8 +198,10 @@ struct StatsView: View {
|
||||
var counts: [UUID: Int] = [:]
|
||||
for plan in weekPlans {
|
||||
for slot in plan.slotList {
|
||||
guard let dishId = slot.dishId, let dish = dishMap[dishId] else { continue }
|
||||
for tagId in dish.tagIds { counts[tagId, default: 0] += 1 }
|
||||
for dishId in [slot.dishId, slot.secondaryDishId].compactMap({ $0 }) {
|
||||
guard let dish = dishMap[dishId] else { continue }
|
||||
for tagId in dish.tagIds { counts[tagId, default: 0] += 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
return counts
|
||||
|
||||
Reference in New Issue
Block a user