From 8704288bf14be1a3567a2a1488e7ad563c630923 Mon Sep 17 00:00:00 2001 From: Raz Date: Mon, 10 Mar 2025 15:39:45 +0100 Subject: [PATCH] fix init team reg --- PadelClub/Data/TeamRegistration.swift | 12 +++++++++++- .../Views/Navigation/Agenda/EventListView.swift | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/PadelClub/Data/TeamRegistration.swift b/PadelClub/Data/TeamRegistration.swift index c6d9d80..72de9bc 100644 --- a/PadelClub/Data/TeamRegistration.swift +++ b/PadelClub/Data/TeamRegistration.swift @@ -648,7 +648,17 @@ final class TeamRegistration: ModelObject, Storable { } func bracketMatchTitleAndQualifiedStatus() -> String? { - let values = [qualified ? "Qualifié" : nil, initialMatch()?.roundAndMatchTitle()].compactMap({ $0 }) + let v = groupStageObject()?.groupStageTitle() + var base = "Qualifié" + if qualified { + if let groupStageTitle = groupStageObject()?.groupStageTitle() { + base = base + " (\(groupStageTitle))" + } + } + + let suffix = qualified ? nil : groupStageObject()?.groupStageTitle() + let initalMatchTitle = initialMatch()?.roundAndMatchTitle() ?? suffix + let values = [qualified ? base : nil, initalMatchTitle].compactMap({ $0 }) if values.isEmpty { return nil } diff --git a/PadelClub/Views/Navigation/Agenda/EventListView.swift b/PadelClub/Views/Navigation/Agenda/EventListView.swift index 1218d7d..f9c0ed5 100644 --- a/PadelClub/Views/Navigation/Agenda/EventListView.swift +++ b/PadelClub/Views/Navigation/Agenda/EventListView.swift @@ -259,6 +259,13 @@ struct EventListView: View { private func _tournamentView(_ tournament: Tournament) -> some View { NavigationLink(value: tournament) { TournamentCellView(tournament: tournament) + .onReceive(NotificationCenter.default.publisher(for: NSNotification.Name.CollectionDidLoad), perform: { notification in + + if let store = notification.object as? StoredCollection, store.id == tournament.id { + tournament.lastTeamRefresh = Date() + } + + }) .id(tournament.lastTeamRefresh) .task(priority: .background) { await tournament.refreshTeamList()