Stabilize planner UI, fix reset flow, and force Premium on TestFlight
This commit is contained in:
@@ -33,3 +33,19 @@ final class MealSlot {
|
||||
set { mealType = newValue.rawValue }
|
||||
}
|
||||
}
|
||||
|
||||
extension MealSlot {
|
||||
static func preferredForDuplicateResolution(_ slots: [MealSlot]) -> MealSlot {
|
||||
slots.sorted { lhs, rhs in
|
||||
let lhsHasDish = lhs.dishId != nil
|
||||
let rhsHasDish = rhs.dishId != nil
|
||||
if lhsHasDish != rhsHasDish { return lhsHasDish }
|
||||
|
||||
let lhsHasEvent = lhs.calendarEventId != nil
|
||||
let rhsHasEvent = rhs.calendarEventId != nil
|
||||
if lhsHasEvent != rhsHasEvent { return lhsHasEvent }
|
||||
|
||||
return lhs.id.uuidString < rhs.id.uuidString
|
||||
}.first ?? slots[0]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user