From 0fcd80153d6a94a7d0590804f696782924b4ac57 Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 26 Jan 2023 16:08:44 +0100 Subject: [PATCH] Fix order --- LeCountdown/Views/NewCountdownView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LeCountdown/Views/NewCountdownView.swift b/LeCountdown/Views/NewCountdownView.swift index 141e4e2..9335e85 100644 --- a/LeCountdown/Views/NewCountdownView.swift +++ b/LeCountdown/Views/NewCountdownView.swift @@ -188,7 +188,8 @@ struct CountdownEditView : View { cd.duration = self._minutes * 60.0 + self._seconds if self._isAdding { - cd.order = Int16(self.countdowns.count) + let max = self.countdowns.map { $0.order }.max() ?? 0 + cd.order = max + 1 } if !self.nameString.isEmpty { cd.activity = CoreDataRequests.getOrCreateActivity(name: self.nameString)