From e1ffa4830a9c0307bffd9ae64875056cb885814d Mon Sep 17 00:00:00 2001 From: Raz Date: Mon, 6 Jan 2025 10:31:00 +0100 Subject: [PATCH] fix 18.2 bug --- PadelClub.xcodeproj/project.pbxproj | 8 ++-- PadelClub/Data/TeamRegistration.swift | 2 +- PadelClub/Data/Tournament.swift | 2 +- .../PlayersWithoutContactView.swift | 2 +- .../Components/InscriptionInfoView.swift | 38 +++++++++---------- .../Screen/InscriptionManagerView.swift | 13 ++----- 6 files changed, 29 insertions(+), 36 deletions(-) diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index a97bf44..b6a7ba5 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -3262,7 +3262,7 @@ CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; @@ -3286,7 +3286,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.41; + MARKETING_VERSION = 1.0.42; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -3307,7 +3307,7 @@ CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; @@ -3330,7 +3330,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.41; + MARKETING_VERSION = 1.0.42; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/PadelClub/Data/TeamRegistration.swift b/PadelClub/Data/TeamRegistration.swift index da189ec..84a4d5e 100644 --- a/PadelClub/Data/TeamRegistration.swift +++ b/PadelClub/Data/TeamRegistration.swift @@ -173,7 +173,7 @@ final class TeamRegistration: ModelObject, Storable { } func getPhoneNumbers() -> [String] { - return players().compactMap { $0.phoneNumber }.filter({ $0.isMobileNumber() }) + return players().compactMap { $0.phoneNumber }.filter({ $0.isEmpty == false }) } func getMail() -> [String] { diff --git a/PadelClub/Data/Tournament.swift b/PadelClub/Data/Tournament.swift index ea926b8..189c987 100644 --- a/PadelClub/Data/Tournament.swift +++ b/PadelClub/Data/Tournament.swift @@ -1136,7 +1136,7 @@ defer { } } - func registrationIssues() async -> Int { + func registrationIssues() -> Int { let players : [PlayerRegistration] = unsortedPlayers() let selectedTeams : [TeamRegistration] = selectedSortedTeams() let callDateIssue : [TeamRegistration] = selectedTeams.filter { $0.callDate != nil && isStartDateIsDifferentThanCallDate($0) } diff --git a/PadelClub/Views/Calling/Components/PlayersWithoutContactView.swift b/PadelClub/Views/Calling/Components/PlayersWithoutContactView.swift index cffae6e..92b38be 100644 --- a/PadelClub/Views/Calling/Components/PlayersWithoutContactView.swift +++ b/PadelClub/Views/Calling/Components/PlayersWithoutContactView.swift @@ -45,7 +45,7 @@ struct PlayersWithoutContactView: View { LabeledContent { Text(withoutPhones.count.formatted()) } label: { - Text("Joueurs sans téléphone portable") + Text("Joueurs sans téléphone portable français") } } } header: { diff --git a/PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift b/PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift index 3fb55c6..d39e5e0 100644 --- a/PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift +++ b/PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift @@ -9,7 +9,7 @@ import SwiftUI struct InscriptionInfoView: View { @EnvironmentObject var dataStore: DataStore - @Environment(Tournament.self) var tournament + let tournament: Tournament @State private var players : [PlayerRegistration] = [] @State private var selectedTeams : [TeamRegistration] = [] @@ -244,30 +244,30 @@ struct InscriptionInfoView: View { Text("importé du fichier beach-padel sans licence valide ou créé sans licence") } } - .task { - await _getIssues() + .onAppear { + DispatchQueue.main.async { + _getIssues() + } } .navigationTitle("Synthèse") .navigationBarTitleDisplayMode(.inline) .toolbarBackground(.visible, for: .navigationBar) } - private func _getIssues() async { - Task { - players = tournament.unsortedPlayers() - selectedTeams = tournament.selectedSortedTeams() - callDateIssue = selectedTeams.filter { $0.callDate != nil && tournament.isStartDateIsDifferentThanCallDate($0) } - waitingList = tournament.waitingListTeams(in: selectedTeams, includingWalkOuts: true) - duplicates = tournament.duplicates(in: players) - homonyms = tournament.homonyms(in: players) - problematicPlayers = players.filter({ $0.sex == nil }) - inadequatePlayers = tournament.inadequatePlayers(in: players) - ageInadequatePlayers = tournament.ageInadequatePlayers(in: players) - let isImported = players.anySatisfy({ $0.isImported() }) - playersWithoutValidLicense = tournament.playersWithoutValidLicense(in: players, isImported: isImported) - entriesFromBeachPadel = tournament.unsortedTeams().filter({ $0.isImported() }) - playersMissing = selectedTeams.filter({ $0.unsortedPlayers().count < 2 }) - } + private func _getIssues() { + players = tournament.unsortedPlayers() + selectedTeams = tournament.selectedSortedTeams() + callDateIssue = selectedTeams.filter { $0.callDate != nil && tournament.isStartDateIsDifferentThanCallDate($0) } + waitingList = tournament.waitingListTeams(in: selectedTeams, includingWalkOuts: true) + duplicates = tournament.duplicates(in: players) + homonyms = tournament.homonyms(in: players) + problematicPlayers = players.filter({ $0.sex == nil }) + inadequatePlayers = tournament.inadequatePlayers(in: players) + ageInadequatePlayers = tournament.ageInadequatePlayers(in: players) + let isImported = players.anySatisfy({ $0.isImported() }) + playersWithoutValidLicense = tournament.playersWithoutValidLicense(in: players, isImported: isImported) + entriesFromBeachPadel = tournament.unsortedTeams().filter({ $0.isImported() }) + playersMissing = selectedTeams.filter({ $0.unsortedPlayers().count < 2 }) } } diff --git a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift index be075c8..775bdc2 100644 --- a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift +++ b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift @@ -173,8 +173,8 @@ struct InscriptionManagerView: View { self.teamsHash = _simpleHash(ids: selectedSortedTeams.map { $0.id }) } self.registrationIssues = nil - Task { - self.registrationIssues = await tournament.registrationIssues() + DispatchQueue.main.async { + self.registrationIssues = tournament.registrationIssues() } } @@ -718,14 +718,7 @@ struct InscriptionManagerView: View { if tournament.isAnimation() == false { NavigationLink { - InscriptionInfoView() - .environment(tournament) - .onDisappear { - self.registrationIssues = nil - Task { - self.registrationIssues = await tournament.registrationIssues() - } - } + InscriptionInfoView(tournament: tournament) } label: { LabeledContent { if let registrationIssues {