fix init team reg

sync2
Raz 8 months ago
parent 5da65dbe35
commit 8704288bf1
  1. 12
      PadelClub/Data/TeamRegistration.swift
  2. 7
      PadelClub/Views/Navigation/Agenda/EventListView.swift

@ -648,7 +648,17 @@ final class TeamRegistration: ModelObject, Storable {
} }
func bracketMatchTitleAndQualifiedStatus() -> String? { 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 { if values.isEmpty {
return nil return nil
} }

@ -259,6 +259,13 @@ struct EventListView: View {
private func _tournamentView(_ tournament: Tournament) -> some View { private func _tournamentView(_ tournament: Tournament) -> some View {
NavigationLink(value: tournament) { NavigationLink(value: tournament) {
TournamentCellView(tournament: tournament) TournamentCellView(tournament: tournament)
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name.CollectionDidLoad), perform: { notification in
if let store = notification.object as? StoredCollection<TeamRegistration>, store.id == tournament.id {
tournament.lastTeamRefresh = Date()
}
})
.id(tournament.lastTeamRefresh) .id(tournament.lastTeamRefresh)
.task(priority: .background) { .task(priority: .background) {
await tournament.refreshTeamList() await tournament.refreshTeamList()

Loading…
Cancel
Save