From 63f5b29d5e75b713ef77eefbcdb6df796774a8af Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Thu, 13 Jun 2024 11:30:17 +0200 Subject: [PATCH 1/7] add multi import --- PadelClub/Data/Tournament.swift | 5 +- .../Views/Components/ButtonValidateView.swift | 4 +- .../GenericDestinationPickerView.swift | 6 +- .../Views/Tournament/FileImportView.swift | 135 ++++++++++++------ 4 files changed, 100 insertions(+), 50 deletions(-) diff --git a/PadelClub/Data/Tournament.swift b/PadelClub/Data/Tournament.swift index 0e609df..853a339 100644 --- a/PadelClub/Data/Tournament.swift +++ b/PadelClub/Data/Tournament.swift @@ -463,7 +463,10 @@ class Tournament : ModelObject, Storable { func shareURL(_ pageLink: PageLink = .matches) -> URL? { if pageLink == .clubBroadcast { - if let club = club(), let broadcastCode = club.broadcastCode { + let club = club() + print("club", club) + print("club broadcast code", club?.broadcastCode) + if let club, let broadcastCode = club.broadcastCode { return URLs.main.url.appending(path: "c/\(broadcastCode)") } else { return nil diff --git a/PadelClub/Views/Components/ButtonValidateView.swift b/PadelClub/Views/Components/ButtonValidateView.swift index e273c0d..0543e4d 100644 --- a/PadelClub/Views/Components/ButtonValidateView.swift +++ b/PadelClub/Views/Components/ButtonValidateView.swift @@ -9,11 +9,11 @@ import SwiftUI struct ButtonValidateView: View { var role: ButtonRole? - + var title: String = "Valider" let action: () -> () var body: some View { - Button("Valider", role: role) { + Button(title, role: role) { action() } .clipShape(Capsule()) diff --git a/PadelClub/Views/Components/GenericDestinationPickerView.swift b/PadelClub/Views/Components/GenericDestinationPickerView.swift index 2c7fc9a..27c28ae 100644 --- a/PadelClub/Views/Components/GenericDestinationPickerView.swift +++ b/PadelClub/Views/Components/GenericDestinationPickerView.swift @@ -49,7 +49,7 @@ struct GenericDestinationPickerView: .buttonStyle(.plain) .overlay(alignment: .bottomTrailing) { if destination.displayImageIfValueZero() { - let count = destination.badgeValue() + let count : Int? = destination.badgeValue() if let count, count == 0, let badge = destination.badgeImage() { Image(systemName: badge.systemName()) .foregroundColor(badge.color()) @@ -60,7 +60,7 @@ struct GenericDestinationPickerView: ) .offset(x: 3, y: 3) } else if let count, count > 0 { - Image(systemName: count <= 50 ? "\(count).circle.fill" : "plus.circle.fill") + Image(systemName: count <= 50 ? "\(String(count)).circle.fill" : "plus.circle.fill") .foregroundColor(destination.badgeValueColor() ?? .red) .imageScale(.medium) .background ( @@ -80,7 +80,7 @@ struct GenericDestinationPickerView: ) .offset(x: 3, y: 3) } else if let count = destination.badgeValue(), count > 0 { - Image(systemName: count <= 50 ? "\(count).circle.fill" : "plus.circle.fill") + Image(systemName: count <= 50 ? "\(String(count)).circle.fill" : "plus.circle.fill") .foregroundColor(destination.badgeValueColor() ?? .red) .imageScale(.medium) .background ( diff --git a/PadelClub/Views/Tournament/FileImportView.swift b/PadelClub/Views/Tournament/FileImportView.swift index 2f918ed..99b856c 100644 --- a/PadelClub/Views/Tournament/FileImportView.swift +++ b/PadelClub/Views/Tournament/FileImportView.swift @@ -28,8 +28,9 @@ struct FileImportView: View { @State private var fileProvider: FileImportManager.FileProvider = .frenchFederation @State private var validationInProgress: Bool = false + @State private var multiImport: Bool = false - private var filteredTeams: [FileImportManager.TeamHolder] { + private func filteredTeams(tournament: Tournament) -> [FileImportManager.TeamHolder] { return teams.filter { $0.tournamentCategory == tournament.tournamentCategory }.sorted(by: \.weight) } @@ -68,6 +69,24 @@ struct FileImportView: View { Text(.init(footerString)) } } + + if let tournaments = tournament.eventObject()?.tournaments, tournaments.count > 1, fileProvider == .frenchFederation { + Section { + RowButtonView("Importer toutes les épreuves") { + multiImport = true + if let fileContent { + do { + try await _startImport(fileContent: fileContent) + } catch { + errorMessage = error.localizedDescription + } + } + } + } footer: { + Text("Ce tournoi possède plusieurs épreuves. Vous pouvez importer les équipes du fichier pour toutes les épreuves d'un coup.") + } + .disabled(fileContent == nil || convertingFile) + } } // if filteredTeams.isEmpty == false && tournament.unsortedTeams().isEmpty == false { @@ -128,7 +147,8 @@ struct FileImportView: View { // } // } - if filteredTeams.isEmpty && teams.isEmpty == false { + let filteredTeams = filteredTeams(tournament: tournament) + if filteredTeams.isEmpty && teams.isEmpty == false && multiImport == false { @Bindable var tournament = tournament Section { Text("Aucune équipe \(tournament.tournamentCategory.importingRawValue) détectée mais \(teams.count) équipes sont dans le fichier") @@ -157,20 +177,38 @@ struct FileImportView: View { .tipStyle(tint: nil) } } - Section { - LabeledContent { - Text(_filteredTeams.count.formatted()) - } label: { - Text("Équipe\(_filteredTeams.count.pluralSuffix) \(tournament.tournamentCategory.importingRawValue) détectée\(_filteredTeams.count.pluralSuffix)") + + if multiImport, fileProvider == .frenchFederation, let tournaments = tournament.eventObject()?.tournaments, tournaments.count > 1 { + ForEach(tournaments) { tournament in + let tournamentFilteredTeams = self.filteredTeams(tournament: tournament) + + Section { + RowButtonView("Valider") { + await _validate(tournament: tournament) + } + } header: { + Text("\(tournamentFilteredTeams.count.formatted()) équipe\(tournamentFilteredTeams.count.pluralSuffix)") + } footer: { + Text(tournament.tournamentTitle()) + } } - } footer: { - if previousTeams.isEmpty == false { - Text("La liste ci-dessous n'est qu'une indication d'évolution par rapport au seul poids d'équipe. Cela ne tient pas compte des dates d'inscriptions, WCs et autres éléments.").foregroundStyle(.logoRed) + .headerProminence(.increased) + } else { + Section { + LabeledContent { + Text(_filteredTeams.count.formatted()) + } label: { + Text("Équipe\(_filteredTeams.count.pluralSuffix) \(tournament.tournamentCategory.importingRawValue) détectée\(_filteredTeams.count.pluralSuffix)") + } + } footer: { + if previousTeams.isEmpty == false { + Text("La liste ci-dessous n'est qu'une indication d'évolution par rapport au seul poids d'équipe. Cela ne tient pas compte des dates d'inscriptions, WCs et autres éléments.").foregroundStyle(.logoRed) + } + } + + ForEach(_filteredTeams) { team in + _teamView(team: team, inTeams: _filteredTeams, previousTeams: previousTeams) } - } - - ForEach(_filteredTeams) { team in - _teamView(team: team, inTeams: _filteredTeams, previousTeams: previousTeams) } } } @@ -215,13 +253,13 @@ struct FileImportView: View { .navigationTitle("Importation") .navigationBarTitleDisplayMode(.large) .toolbar { - ToolbarItem(placement: .bottomBar) { - PasteButton(payloadType: String.self) { strings in - guard let string = strings.first else { return } - fileContent = string - fileProvider = .padelClub - } - } +// ToolbarItem(placement: .bottomBar) { +// PasteButton(payloadType: String.self) { strings in +// guard let string = strings.first else { return } +// fileContent = string +// fileProvider = .padelClub +// } +// } ToolbarItem(placement: .cancellationAction) { Button("Annuler", role: .cancel) { dismiss() @@ -232,8 +270,19 @@ struct FileImportView: View { if validationInProgress { ProgressView() } else { - ButtonValidateView { + ButtonValidateView(title: (multiImport ? "Tout Valider" : "Valider")) { validationInProgress = true + Task { + if let tournaments = tournament.eventObject()?.tournaments, tournaments.count > 1, multiImport { + for tournament in tournaments { + await _validate(tournament: tournament) + } + + dismiss() + } else { + await _validate(tournament: tournament) + } + } } .disabled(teams.isEmpty) } @@ -241,30 +290,28 @@ struct FileImportView: View { } .interactiveDismissDisabled(validationInProgress) .disabled(validationInProgress) - .onChange(of: validationInProgress) { - _validate() - } } - private func _validate() { - Task { - let previousTeams = filteredTeams.compactMap({ $0.previousTeam }) - - let unfound = Set(tournament.unsortedTeams()).subtracting(Set(previousTeams)) - unfound.forEach { team in - team.resetPositions() - team.wildCardBracket = false - team.wildCardGroupStage = false - team.walkOut = true - } - - do { - try dataStore.teamRegistrations.addOrUpdate(contentOfs: unfound) - } catch { - Logger.error(error) - } - - tournament.importTeams(filteredTeams) + private func _validate(tournament: Tournament) async { + let filteredTeams = filteredTeams(tournament: tournament) + let previousTeams = filteredTeams.compactMap({ $0.previousTeam }) + + let unfound = Set(tournament.unsortedTeams()).subtracting(Set(previousTeams)) + unfound.forEach { team in + team.resetPositions() + team.wildCardBracket = false + team.wildCardGroupStage = false + team.walkOut = true + } + + do { + try dataStore.teamRegistrations.addOrUpdate(contentOfs: unfound) + } catch { + Logger.error(error) + } + + tournament.importTeams(filteredTeams) + if multiImport == false { dismiss() } } From ec116617fc14c20484fbe2c2dccd2cc7c1f48b2b Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Thu, 13 Jun 2024 12:37:22 +0200 Subject: [PATCH 2/7] fix dependcy of team reg and team score --- PadelClub/Data/TeamRegistration.swift | 1 + .../Screen/InscriptionManagerView.swift | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/PadelClub/Data/TeamRegistration.swift b/PadelClub/Data/TeamRegistration.swift index baf6e84..606e32c 100644 --- a/PadelClub/Data/TeamRegistration.swift +++ b/PadelClub/Data/TeamRegistration.swift @@ -67,6 +67,7 @@ class TeamRegistration: ModelObject, Storable { override func deleteDependencies() throws { DataStore.shared.playerRegistrations.deleteDependencies(self.unsortedPlayers()) + DataStore.shared.teamScores.deleteDependencies(self.teamScores()) } func hasArrived() { diff --git a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift index 69c4864..65935cd 100644 --- a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift +++ b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift @@ -215,8 +215,7 @@ struct InscriptionManagerView: View { Button("OK") { } } message: { - let message = [networkMonitor.connected == false ? "L'appareil n'est pas connecté à internet." as String? : nil, sentError == .mailNotSent ? "Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer." as String? : nil, (sentError == .messageFailed || sentError == .messageNotSent) ? "Le SMS n'a pas été envoyé" as String? : nil, sentError == .mailFailed ? "Le mail n'a pas été envoyé" as String? : nil].compacted().joined(separator: "\n") - Text(message) + Text(_getErrorMessage()) } .sheet(item: $contactType) { contactType in Group { @@ -991,7 +990,7 @@ struct InscriptionManagerView: View { } } else { RowButtonView("Modifier l'équipe") { - _updateTeam(checkDuplicates: true) + _updateTeam(checkDuplicates: false) } } @@ -1231,6 +1230,16 @@ struct InscriptionManagerView: View { } } + private func _getErrorMessage() -> String { + let m1 : String? = (networkMonitor.connected == false ? "L'appareil n'est pas connecté à internet." : nil) + let m2 : String? = (sentError == .mailNotSent ? "Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer." : nil) + let m3 : String? = ((sentError == .messageFailed || sentError == .messageNotSent) ? "Le SMS n'a pas été envoyé" : nil) + let m4 : String? = (sentError == .mailFailed ? "Le mail n'a pas été envoyé" : nil) + + let message : String = [m1, m2, m3, m4].compacted().joined(separator: "\n") + return message + } + private func _save() { do { try dataStore.tournaments.addOrUpdate(instance: tournament) From 28fe27d8d64b01ea3b97d2e60d24f850cf8a9e9f Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Thu, 13 Jun 2024 15:10:12 +0200 Subject: [PATCH 3/7] fix stuff --- PadelClub/Data/TeamRegistration.swift | 6 +++--- PadelClub/Data/Tournament.swift | 2 +- PadelClub/Views/Shared/ImportedPlayerView.swift | 2 +- .../Views/Tournament/Screen/InscriptionManagerView.swift | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PadelClub/Data/TeamRegistration.swift b/PadelClub/Data/TeamRegistration.swift index 606e32c..824870d 100644 --- a/PadelClub/Data/TeamRegistration.swift +++ b/PadelClub/Data/TeamRegistration.swift @@ -200,13 +200,13 @@ class TeamRegistration: ModelObject, Storable { return ids.hashValue == searchedIds.hashValue } - func includes(_ players: [PlayerRegistration]) -> Bool { + func includes(players: [PlayerRegistration]) -> Bool { return players.allSatisfy { player in - includes(player) + includes(player: player) } } - func includes(_ player: PlayerRegistration) -> Bool { + func includes(player: PlayerRegistration) -> Bool { return unsortedPlayers().anySatisfy { _player in _player.isSameAs(player) } diff --git a/PadelClub/Data/Tournament.swift b/PadelClub/Data/Tournament.swift index 853a339..409f071 100644 --- a/PadelClub/Data/Tournament.swift +++ b/PadelClub/Data/Tournament.swift @@ -1195,7 +1195,7 @@ class Tournament : ModelObject, Storable { } func findTeam(_ players: [PlayerRegistration]) -> TeamRegistration? { - return unsortedTeams().first(where: { $0.includes(players) }) + return unsortedTeams().first(where: { $0.includes(players: players) }) } func tournamentTitle(_ displayStyle: DisplayStyle = .wide) -> String { diff --git a/PadelClub/Views/Shared/ImportedPlayerView.swift b/PadelClub/Views/Shared/ImportedPlayerView.swift index a254fc0..d16fdef 100644 --- a/PadelClub/Views/Shared/ImportedPlayerView.swift +++ b/PadelClub/Views/Shared/ImportedPlayerView.swift @@ -72,8 +72,8 @@ struct ImportedPlayerView: View { Text("messieurs") } .font(.caption) + Text(")").font(.title3) } - Text(")").font(.title3) } HStack { diff --git a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift index 65935cd..16d463b 100644 --- a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift +++ b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift @@ -961,7 +961,7 @@ struct InscriptionManagerView: View { ForEach(createdPlayerIds.sorted(), id: \.self) { id in if let p = createdPlayers.first(where: { $0.id == id }) { VStack(alignment: .leading, spacing: 0) { - if unsortedPlayers.first(where: { $0.licenceId == p.licenceId }) != nil { + if let player = unsortedPlayers.first(where: { $0.licenceId == p.licenceId }), editedTeam?.includes(player: player) == false { Text("Déjà inscrit !").foregroundStyle(.logoRed).bold() } PlayerView(player: p).tag(p.id) From a596e9ed856b72cf953345a34977619af8bee360 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Thu, 13 Jun 2024 15:10:40 +0200 Subject: [PATCH 4/7] b49 --- PadelClub.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index f3df320..501a176 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -1859,7 +1859,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 48; + CURRENT_PROJECT_VERSION = 49; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; @@ -1897,7 +1897,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 48; + CURRENT_PROJECT_VERSION = 49; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; From 8a1d59ac2e66887e1a11b415ec3858753afe6284 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Fri, 14 Jun 2024 09:59:01 +0200 Subject: [PATCH 5/7] fix stuff --- PadelClub/Views/Player/PlayerDetailView.swift | 117 ++++++++++++++++-- PadelClub/Views/Team/EditingTeamView.swift | 26 ++++ PadelClub/Views/Team/TeamDetailView.swift | 1 + .../Screen/InscriptionManagerView.swift | 5 - 4 files changed, 134 insertions(+), 15 deletions(-) diff --git a/PadelClub/Views/Player/PlayerDetailView.swift b/PadelClub/Views/Player/PlayerDetailView.swift index 33d8f00..24687d0 100644 --- a/PadelClub/Views/Player/PlayerDetailView.swift +++ b/PadelClub/Views/Player/PlayerDetailView.swift @@ -12,7 +12,17 @@ struct PlayerDetailView: View { @Environment(Tournament.self) var tournament: Tournament @EnvironmentObject var dataStore: DataStore @Bindable var player: PlayerRegistration - @FocusState private var textFieldIsFocus: Bool + @State private var licenceId: String + @State private var phoneNumber: String + @State private var email: String + @FocusState var focusedField: PlayerRegistration.CodingKeys? + + init(player: PlayerRegistration) { + self.player = player + _licenceId = .init(wrappedValue: player.licenceId ?? "") + _email = .init(wrappedValue: player.email ?? "") + _phoneNumber = .init(wrappedValue: player.phoneNumber ?? "") + } var body: some View { Form { @@ -22,15 +32,21 @@ struct PlayerDetailView: View { .keyboardType(.alphabet) .multilineTextAlignment(.trailing) .frame(maxWidth: .infinity) + .onSubmit(of: .text) { + _save() + } } label: { Text("Nom") } - + LabeledContent { TextField("Prénom", text: $player.firstName) .keyboardType(.alphabet) .multilineTextAlignment(.trailing) .frame(maxWidth: .infinity) + .onSubmit(of: .text) { + _save() + } } label: { Text("Prénom") } @@ -44,7 +60,7 @@ struct PlayerDetailView: View { .keyboardType(.decimalPad) .multilineTextAlignment(.trailing) .frame(maxWidth: .infinity) - .focused($textFieldIsFocus) + .focused($focusedField, equals: ._rank) } label: { Text("Rang") } @@ -69,7 +85,7 @@ struct PlayerDetailView: View { .keyboardType(.decimalPad) .multilineTextAlignment(.trailing) .frame(maxWidth: .infinity) - .focused($textFieldIsFocus) + .focused($focusedField, equals: ._computedRank) } label: { Text("Poids re-calculé") } @@ -79,17 +95,90 @@ struct PlayerDetailView: View { Text("Calculé en fonction du sexe") } } + + Section { + Toggle("Joueur sur place", isOn: $player.hasArrived) + } + + Section { + LabeledContent { + TextField("Licence", text: $licenceId) + .keyboardType(.alphabet) + .multilineTextAlignment(.trailing) + .autocorrectionDisabled() + .frame(maxWidth: .infinity) + .onSubmit(of: .text) { + player.licenceId = licenceId + _save() + } + } label: { + Text("Licence") + } + + RowButtonView("Copier dans le presse-papier") { + let pasteboard = UIPasteboard.general + pasteboard.string = player.licenceId?.strippedLicense + } + } + + Section { + LabeledContent { + TextField("Téléphone", text: $phoneNumber) + .keyboardType(.namePhonePad) + .multilineTextAlignment(.trailing) + .autocorrectionDisabled() + .frame(maxWidth: .infinity) + .onSubmit(of: .text) { + player.phoneNumber = phoneNumber + _save() + } + } label: { + Text("Téléphone") + } + + RowButtonView("Copier dans le presse-papier") { + let pasteboard = UIPasteboard.general + pasteboard.string = player.phoneNumber + } + } + + Section { + LabeledContent { + TextField("Email", text: $email) + .keyboardType(.emailAddress) + .multilineTextAlignment(.trailing) + .autocorrectionDisabled() + .frame(maxWidth: .infinity) + .onSubmit(of: .text) { + player.email = email + _save() + } + } label: { + Text("Email") + } + + RowButtonView("Copier dans le presse-papier") { + let pasteboard = UIPasteboard.general + pasteboard.string = player.email + } + } + + } + .toolbar { + ToolbarItem(placement: .topBarTrailing) { + ShareLink(item: player.pasteData()) { + Label("Partagez", systemImage: "square.and.arrow.up") + } + } } .scrollDismissesKeyboard(.immediately) - .onChange(of: player.sex) { + .onChange(of: player.hasArrived) { _save() } - .onChange(of: player.computedRank) { - player.team()?.updateWeight(inTournamentCategory: tournament.tournamentCategory) + .onChange(of: player.sex) { _save() } - .onChange(of: player.rank) { - player.setComputedRank(in: tournament) + .onChange(of: player.computedRank) { player.team()?.updateWeight(inTournamentCategory: tournament.tournamentCategory) _save() } @@ -100,7 +189,15 @@ struct PlayerDetailView: View { .toolbar { ToolbarItem(placement: .keyboard) { Button("Valider") { - textFieldIsFocus = false + if focusedField == ._rank { + player.setComputedRank(in: tournament) + player.team()?.updateWeight(inTournamentCategory: tournament.tournamentCategory) + _save() + } else if focusedField == ._computedRank { + player.team()?.updateWeight(inTournamentCategory: tournament.tournamentCategory) + _save() + } + focusedField = nil } } } diff --git a/PadelClub/Views/Team/EditingTeamView.swift b/PadelClub/Views/Team/EditingTeamView.swift index 0612876..e63f725 100644 --- a/PadelClub/Views/Team/EditingTeamView.swift +++ b/PadelClub/Views/Team/EditingTeamView.swift @@ -46,6 +46,17 @@ struct EditingTeamView: View { Text("Date d'inscription") } + Section { + Toggle(isOn: hasArrived) { + Text("Équipe sur place") + } + /* + Toggle(isOn: $team.confirmedCall) { + Text("Équipe sur place") + } + */ + } + Section { RowButtonView("Retirer des poules", role: .destructive) { team.resetGroupeStagePosition() @@ -72,6 +83,21 @@ struct EditingTeamView: View { .toolbarBackground(.visible, for: .navigationBar) } + private var hasArrived: Binding { + Binding { + team.unsortedPlayers().allSatisfy({ $0.hasArrived }) + } set: { hasArrived in + team.unsortedPlayers().forEach { + $0.hasArrived = hasArrived + } + do { + try dataStore.playerRegistrations.addOrUpdate(contentOfs: team.unsortedPlayers()) + } catch { + Logger.error(error) + } + } + + } private func _save() { do { try dataStore.teamRegistrations.addOrUpdate(instance: team) diff --git a/PadelClub/Views/Team/TeamDetailView.swift b/PadelClub/Views/Team/TeamDetailView.swift index 2131e41..889341c 100644 --- a/PadelClub/Views/Team/TeamDetailView.swift +++ b/PadelClub/Views/Team/TeamDetailView.swift @@ -6,6 +6,7 @@ // import SwiftUI +import LeStorage struct TeamDetailView: View { @Environment(Tournament.self) var tournament: Tournament diff --git a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift index 16d463b..7c8172e 100644 --- a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift +++ b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift @@ -533,11 +533,6 @@ struct InscriptionManagerView: View { let teamIndex = team.index(in: sortedTeams) Section { TeamDetailView(team: team) - .contextMenu { - Button("équipe présente") { - team.hasArrived() - } - } } header: { TeamHeaderView(team: team, teamIndex: teamIndex, tournament: tournament) } footer: { From 5479655be9a139c55a2b5f42996ceff217065783 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Fri, 14 Jun 2024 09:59:58 +0200 Subject: [PATCH 6/7] v50 --- PadelClub.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index 501a176..08777bd 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -1859,7 +1859,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 49; + CURRENT_PROJECT_VERSION = 50; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; @@ -1897,7 +1897,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 49; + CURRENT_PROJECT_VERSION = 50; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; From 438b7baa3aeb13d71035522005bb547ad3d3ac6d Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Fri, 14 Jun 2024 10:15:08 +0200 Subject: [PATCH 7/7] fix issue --- PadelClub/Views/Tournament/TournamentView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/PadelClub/Views/Tournament/TournamentView.swift b/PadelClub/Views/Tournament/TournamentView.swift index 0049fb2..297cd7b 100644 --- a/PadelClub/Views/Tournament/TournamentView.swift +++ b/PadelClub/Views/Tournament/TournamentView.swift @@ -75,6 +75,7 @@ struct TournamentView: View { } } } + .id(tournament.id) .toolbarBackground(.visible, for: .navigationBar) .navigationDestination(for: Screen.self, destination: { screen in Group {