Files
FamilyMealPlanner/MealMood/Models/ShoppingItem.swift
T
alexandrev-tibco 6fe16d8e29 huecos sin planificar y exclusiones en la lista de la compra
- MealSlot.isSkipped: opcion "No planificar esta comida" en el picker de
  hueco vacio — cuenta como resuelto (semana completa, notificaciones,
  stats) y el autocompletado lo respeta; vista gris con guion, tap para
  desmarcar; viaja en undo, snapshot KV (junto con isEatingOut, que
  faltaba en el payload) y exports (— en imagen, omitido en texto)
- ShoppingItem.isDismissed: "Ya lo tengo" por ingrediente (swipe
  izquierdo) y "Ya esta hecho" por plato entero (boton en la cabecera de
  su seccion); van a la seccion "Ya en casa" con restauracion de un tap,
  y quedan fuera del export de texto. No se borran porque reconcile los
  recrearia
- Esquema CloudKit Development: CD_isSkipped, CD_isDismissed y el record
  type CD_ShoppingItem entero, que no existia — la lista de la compra no
  estaba sincronizando entre dispositivos (mismo bug que photoData)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013H6bXqGX1ygwib1Dm3n3UG
2026-09-01 16:16:34 +02:00

41 lines
1.3 KiB
Swift

import Foundation
import SwiftData
/// One line of the weekly shopping list. Items are either derived from a
/// planned dish's ingredients (`dishId` set) or added free-hand by the user
/// (`dishId == nil`). Check-off state persists across app launches.
// CloudKit-compatible (2.0): no unique constraints, inline defaults everywhere.
@Model
final class ShoppingItem {
var id: UUID = UUID()
var weekStartDate: Date = Date()
var title: String = ""
var dishId: UUID?
var isChecked: Bool = false
/// "Already have it at home": kept out of the active list and the export,
/// but not deleted reconcile would recreate a deleted dish-derived line.
var isDismissed: Bool = false
var sortOrder: Int = 0
var createdAt: Date = Date()
init(
id: UUID = UUID(),
weekStartDate: Date,
title: String,
dishId: UUID? = nil,
isChecked: Bool = false,
isDismissed: Bool = false,
sortOrder: Int = 0,
createdAt: Date = Date()
) {
self.id = id
self.weekStartDate = weekStartDate
self.title = title
self.dishId = dishId
self.isChecked = isChecked
self.isDismissed = isDismissed
self.sortOrder = sortOrder
self.createdAt = createdAt
}
}