diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index 2ac6591..b9369ed 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -3117,7 +3117,7 @@ CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; @@ -3144,7 +3144,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2.46; + MARKETING_VERSION = 1.2.48; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -3165,7 +3165,7 @@ CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; @@ -3190,7 +3190,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2.46; + MARKETING_VERSION = 1.2.48; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/PadelClub/Data/Federal/FederalPlayer.swift b/PadelClub/Data/Federal/FederalPlayer.swift index 3573a3e..141c613 100644 --- a/PadelClub/Data/Federal/FederalPlayer.swift +++ b/PadelClub/Data/Federal/FederalPlayer.swift @@ -80,7 +80,12 @@ class FederalPlayer: Decodable { let ageSportif = try container.decodeIfPresent(Int.self, forKey: .ageSportif) if let ageSportif { - birthYear = Calendar.current.component(.year, from: Date()) - ageSportif + let month = Calendar.current.component(.month, from: Date()) + if month > 8 { + birthYear = Calendar.current.component(.year, from: Date()) + 1 - ageSportif + } else { + birthYear = Calendar.current.component(.year, from: Date()) - ageSportif + } } clubCode = try container.decodeIfPresent(String.self, forKey: .codeClub) ?? "" club = try container.decodeIfPresent(String.self, forKey: .nomClub) ?? "" diff --git a/PadelClub/Views/Cashier/Event/EventCreationView.swift b/PadelClub/Views/Cashier/Event/EventCreationView.swift index b63e77b..ef14271 100644 --- a/PadelClub/Views/Cashier/Event/EventCreationView.swift +++ b/PadelClub/Views/Cashier/Event/EventCreationView.swift @@ -154,7 +154,7 @@ struct EventCreationView: View { tournament.courtCount = selectedClub?.courtCount ?? 2 tournament.startDate = startingDate tournament.dayDuration = duration - tournament.initSettings(templateTournament: templateTournament) + tournament.initSettings(templateTournament: templateTournament, overrideTeamCount: false) } do { diff --git a/PadelClub/Views/Cashier/Event/EventTournamentsView.swift b/PadelClub/Views/Cashier/Event/EventTournamentsView.swift index 3924aab..2d554fc 100644 --- a/PadelClub/Views/Cashier/Event/EventTournamentsView.swift +++ b/PadelClub/Views/Cashier/Event/EventTournamentsView.swift @@ -35,6 +35,14 @@ struct EventTournamentsView: View { } label: { TournamentCellView(tournament: tournament) .contextMenu { + + NavigationLink { + TournamentSettingsView() + .environment(tournament) + } label: { + Label("Paramètres", systemImage: "gearshape.fill") + } + Button { navigation.openTournamentInOrganizer(tournament) } label: { @@ -134,8 +142,7 @@ struct EventTournamentsView: View { newTournament.courtCount = event.eventCourtCount() newTournament.startDate = event.eventStartDate() newTournament.dayDuration = event.eventDayDuration() - newTournament.initSettings(templateTournament: Tournament.getTemplateTournament()) - + newTournament.initSettings(templateTournament: Tournament.getTemplateTournament(), overrideTeamCount: false) dataStore.tournaments.addOrUpdate(instance: newTournament) self.newTournament = nil diff --git a/PadelClub/Views/Match/MatchDetailView.swift b/PadelClub/Views/Match/MatchDetailView.swift index 2796bd9..62896f5 100644 --- a/PadelClub/Views/Match/MatchDetailView.swift +++ b/PadelClub/Views/Match/MatchDetailView.swift @@ -361,6 +361,33 @@ struct MatchDetailView: View { Text("Remise-à-zéro") } + Menu { + Button("Effacer le nom") { + match.name = nil + tournamentStore?.matches.addOrUpdate(instance: match) + } + + if let tournament = match.currentTournament() { + Menu { + ForEach(tournament.generateSeedGroups(base: 16, teamCount: 8), id: \.self) { seedGroup in + Button { + match.name = seedGroup.localizedInterval() + tournamentStore?.matches.addOrUpdate(instance: match) + } label: { + Text(seedGroup.localizedInterval()) + } + } + } label: { + Text("Choisir un nom") + } + } + } label: { + Text("[Site] Nom du match") + if let name = match.name { + Text("(\(name))") + } + } + if match.teamScores.isEmpty == false { Divider() Menu { diff --git a/PadelClub/Views/Tournament/Screen/TableStructureView.swift b/PadelClub/Views/Tournament/Screen/TableStructureView.swift index 43805d5..652f4d9 100644 --- a/PadelClub/Views/Tournament/Screen/TableStructureView.swift +++ b/PadelClub/Views/Tournament/Screen/TableStructureView.swift @@ -265,7 +265,7 @@ struct TableStructureView: View { } } - if tournament.rounds().isEmpty, tournament.state() == .build { + if tournament.rounds().isEmpty { Section { RowButtonView("Ajouter un tableau", role: .destructive) { tournament.buildBracket(minimalBracketTeamCount: 4)