From 63ee9608af7fd0d7cf50996797d100f46d2c17ae Mon Sep 17 00:00:00 2001 From: Scarriffle Date: Sun, 2 Aug 2026 16:40:29 +0200 Subject: [PATCH] iOS: Am Ablauftag 'heute' statt '0 Tage' Die Uebersichtskarte 'Bald ablaufend' zeigte am Ablauftag '0 Tage'. Jetzt gemeinsame Formulierung auf ExpiringItem.restlaufzeitText: abgelaufen / heute / morgen / X Tage - Karte und volle Liste identisch. Co-Authored-By: Claude Opus 4.8 --- ios/Sources/DashboardCards.swift | 2 +- ios/Sources/ListViews.swift | 7 +------ ios/Sources/Models.swift | 9 +++++++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ios/Sources/DashboardCards.swift b/ios/Sources/DashboardCards.swift index 4481f8d..72569ca 100644 --- a/ios/Sources/DashboardCards.swift +++ b/ios/Sources/DashboardCards.swift @@ -295,7 +295,7 @@ struct ExpiryCard: View { .font(.caption2).foregroundStyle(.secondary) } Spacer() - Text(item.daysLeft < 0 ? "abgelaufen" : "\(item.daysLeft) Tage") + Text(item.restlaufzeitText) .font(.caption).bold() .foregroundStyle(item.daysLeft < 0 ? .red : .orange) } diff --git a/ios/Sources/ListViews.swift b/ios/Sources/ListViews.swift index 965ba4d..39cf856 100644 --- a/ios/Sources/ListViews.swift +++ b/ios/Sources/ListViews.swift @@ -146,7 +146,7 @@ struct ExpiringView: View { .font(.caption).foregroundStyle(.secondary) } Spacer() - Text(restText(item.daysLeft)) + Text(item.restlaufzeitText) .font(.caption).bold() .foregroundStyle(item.daysLeft < 0 ? .red : .orange) } @@ -181,11 +181,6 @@ struct ExpiringView: View { return "\(formatAmount(item.quantity / faktor)) \(item.unitName)" } - private func restText(_ days: Int) -> String { - if days < 0 { return "abgelaufen" } - if days == 0 { return "heute" } - return days == 1 ? "1 Tag" : "\(days) Tage" - } } // MARK: - Mindestbestände diff --git a/ios/Sources/Models.swift b/ios/Sources/Models.swift index 88643d4..bade83e 100644 --- a/ios/Sources/Models.swift +++ b/ios/Sources/Models.swift @@ -504,6 +504,15 @@ struct ExpiringItem: Codable, Identifiable { var id: Int { lotId } + /// Restlaufzeit als kurzer Text. „0 Tage" ergibt keinen Sinn - am Ablauftag + /// selbst steht „heute". Karte und Liste nutzen dieselbe Formulierung. + var restlaufzeitText: String { + if daysLeft < 0 { return "abgelaufen" } + if daysLeft == 0 { return "heute" } + if daysLeft == 1 { return "morgen" } + return "\(daysLeft) Tage" + } + enum CodingKeys: String, CodingKey { case quantity case lotId = "lot_id"