update 2026 rules

newoffer2025
Razmig Sarkissian 3 months ago
parent 908edea494
commit 26ec624f4b
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 2
      PadelClub/Data/Coredata/ImportedPlayer+Extensions.swift
  3. 2
      PadelClub/Extensions/Tournament+Extensions.swift
  4. 4
      PadelClub/Views/Match/EditSharingView.swift
  5. 1
      PadelClub/Views/Navigation/Agenda/ActivityView.swift
  6. 42
      PadelClub/Views/Navigation/Agenda/TournamentLookUpView.swift
  7. 2
      PadelClub/Views/Player/PlayerDetailView.swift
  8. 2
      PadelClub/Views/Team/EditingTeamView.swift
  9. 46
      PadelClub/Views/Tournament/FileImportView.swift
  10. 1
      PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift

@ -3145,7 +3145,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.2.45; MARKETING_VERSION = 1.2.46;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -3191,7 +3191,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.2.45; MARKETING_VERSION = 1.2.46;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

@ -132,6 +132,6 @@ extension ImportedPlayer: PlayerHolder {
fileprivate extension Int { fileprivate extension Int {
var femaleInMaleAssimilation: Int { var femaleInMaleAssimilation: Int {
self + TournamentCategory.femaleInMaleAssimilationAddition(self) self + TournamentCategory.femaleInMaleAssimilationAddition(self, seasonYear: Date.now.seasonYear())
} }
} }

@ -172,7 +172,7 @@ extension Tournament {
func isPlayerRankInadequate(player: PlayerHolder) -> Bool { func isPlayerRankInadequate(player: PlayerHolder) -> Bool {
guard let rank = player.getRank() else { return false } guard let rank = player.getRank() else { return false }
let _rank = player.male ? rank : rank + PlayerRegistration.addon(for: rank, manMax: maleUnrankedValue ?? 0, womanMax: femaleUnrankedValue ?? 0) let _rank = player.male ? rank : rank + addon(for: rank, manMax: maleUnrankedValue ?? 0, womanMax: femaleUnrankedValue ?? 0)
if _rank <= tournamentLevel.minimumPlayerRank(category: tournamentCategory, ageCategory: federalTournamentAge) { if _rank <= tournamentLevel.minimumPlayerRank(category: tournamentCategory, ageCategory: federalTournamentAge) {
return true return true
} else { } else {

@ -58,9 +58,9 @@ struct EditSharingView: View {
messageData.append(message) messageData.append(message)
guard guard
let labelOne = match.team(.one)?.teamLabelRanked( let labelOne = match.team(.one)?.teamLabelRanked(displayStyle: .title,
displayRank: displayRank, displayTeamName: displayTeamName), displayRank: displayRank, displayTeamName: displayTeamName),
let labelTwo = match.team(.two)?.teamLabelRanked( let labelTwo = match.team(.two)?.teamLabelRanked(displayStyle: .title,
displayRank: displayRank, displayTeamName: displayTeamName) displayRank: displayRank, displayTeamName: displayTeamName)
else { else {
return messageData.joined(separator: "\n") return messageData.joined(separator: "\n")

@ -314,6 +314,7 @@ struct ActivityView: View {
NavigationStack { NavigationStack {
TournamentLookUpView() TournamentLookUpView()
.environment(federalDataViewModel) .environment(federalDataViewModel)
.environment(navigation)
} }
} }
.sheet(item: $newTournament) { tournament in .sheet(item: $newTournament) { tournament in

@ -9,10 +9,12 @@ import SwiftUI
import CoreLocation import CoreLocation
import CoreLocationUI import CoreLocationUI
import PadelClubData import PadelClubData
import LeStorage
struct TournamentLookUpView: View { struct TournamentLookUpView: View {
@EnvironmentObject var dataStore: DataStore @EnvironmentObject var dataStore: DataStore
@Environment(FederalDataViewModel.self) var federalDataViewModel: FederalDataViewModel @Environment(FederalDataViewModel.self) var federalDataViewModel: FederalDataViewModel
@Environment(NavigationViewModel.self) var navigationViewModel: NavigationViewModel
@StateObject var locationManager = LocationManager() @StateObject var locationManager = LocationManager()
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
@FocusState private var isFocused: Bool @FocusState private var isFocused: Bool
@ -27,11 +29,20 @@ struct TournamentLookUpView: View {
@State private var presentAlert: Bool = false @State private var presentAlert: Bool = false
@State private var confirmSearch: Bool = false @State private var confirmSearch: Bool = false
@State private var locationRequested = false @State private var locationRequested = false
@State private var apiError: StoreError?
var tournaments: [FederalTournament] { var tournaments: [FederalTournament] {
federalDataViewModel.searchedFederalTournaments federalDataViewModel.searchedFederalTournaments
} }
var presentApiError: Binding<Bool> {
Binding {
apiError != nil
} set: { value in
}
}
var showLastError: Binding<Bool> { var showLastError: Binding<Bool> {
Binding { Binding {
locationManager.lastError != nil locationManager.lastError != nil
@ -70,6 +81,26 @@ struct TournamentLookUpView: View {
secondaryButton: .cancel() secondaryButton: .cancel()
) )
} }
.alert(isPresented: presentApiError, error: apiError, actions: { storeError in
switch storeError {
case .missingUsername:
Button("Créer un compte ou se connecter") {
dismiss()
navigationViewModel.selectedTab = .umpire
}
default:
Button("D'accord") {
apiError = nil
}
}
}, message: { storeError in
switch storeError {
case .missingUsername:
Text("Un compte est requis pour utiliser ce service de Padel Club, veuillez créer un compte ou vous connecter.")
default:
Text("Une erreur est survenue, veuillez réessayer plus tard.")
}
})
.alert("Attention", isPresented: $presentAlert, actions: { .alert("Attention", isPresented: $presentAlert, actions: {
Button { Button {
presentAlert = false presentAlert = false
@ -79,7 +110,10 @@ struct TournamentLookUpView: View {
Task { Task {
await getNewPage() await getNewPage()
searching = false searching = false
dismiss()
if apiError == nil {
dismiss()
}
} }
} label: { } label: {
Label("Tout voir", systemImage: "arrow.down.circle") Label("Tout voir", systemImage: "arrow.down.circle")
@ -232,7 +266,7 @@ struct TournamentLookUpView: View {
searching = false searching = false
if tournaments.isEmpty == false && tournaments.count < total && total >= 200 && requestedToGetAllPages == false { if tournaments.isEmpty == false && tournaments.count < total && total >= 200 && requestedToGetAllPages == false {
presentAlert = true presentAlert = true
} else { } else if apiError == nil {
dismiss() dismiss()
} }
} }
@ -294,7 +328,9 @@ struct TournamentLookUpView: View {
} else { } else {
print("finished") print("finished")
} }
} catch let error as StoreError {
print("getNewPage", error)
apiError = error
} catch { } catch {
print("getNewPage", error) print("getNewPage", error)
} }

@ -157,7 +157,7 @@ struct PlayerDetailView: View {
} }
} else if player.isMalePlayer() == false && tournament.tournamentCategory == .men, let rank = player.rank { } else if player.isMalePlayer() == false && tournament.tournamentCategory == .men, let rank = player.rank {
Section { Section {
let value = PlayerRegistration.addon(for: rank, manMax: maxMaleUnrankedValue, womanMax: tournament.femaleUnrankedValue ?? 0) let value = tournament.addon(for: rank, manMax: maxMaleUnrankedValue, womanMax: tournament.femaleUnrankedValue ?? 0)
LabeledContent { LabeledContent {
Text(value.formatted()) Text(value.formatted())
} label: { } label: {

@ -268,7 +268,7 @@ struct EditingTeamView: View {
Text("Nom de l'équipe") Text("Nom de l'équipe")
} }
if tournament.tournamentLevel.coachingIsAuthorized { if tournament.coachingIsAuthorized() {
CoachListView(team: team) CoachListView(team: team)
} }

@ -64,6 +64,7 @@ enum FileImportCustomField: Int, Identifiable, CaseIterable {
struct FileImportView: View { struct FileImportView: View {
@EnvironmentObject var dataStore: DataStore @EnvironmentObject var dataStore: DataStore
@Environment(NavigationViewModel.self) var navigationViewModel: NavigationViewModel
@Environment(Tournament.self) var tournament: Tournament @Environment(Tournament.self) var tournament: Tournament
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
@ -84,6 +85,15 @@ struct FileImportView: View {
@State private var presentFormatHelperView: Bool = false @State private var presentFormatHelperView: Bool = false
@State private var validatedTournamentIds: Set<String> = Set() @State private var validatedTournamentIds: Set<String> = Set()
@State private var chunkMode: ChunkMode = .byParameter @State private var chunkMode: ChunkMode = .byParameter
@State private var apiError: StoreError?
var presentApiError: Binding<Bool> {
Binding {
apiError != nil
} set: { value in
}
}
enum ChunkMode: Int, Identifiable, CaseIterable { enum ChunkMode: Int, Identifiable, CaseIterable {
var id: Int { self.rawValue } var id: Int { self.rawValue }
@ -175,7 +185,11 @@ struct FileImportView: View {
if let fileContent { if let fileContent {
do { do {
try await _startImport(fileContent: fileContent, allTournaments: false) try await _startImport(fileContent: fileContent, allTournaments: false)
} catch let error as StoreError {
Logger.error(error)
apiError = error
} catch { } catch {
Logger.error(error)
errorMessage = error.localizedDescription errorMessage = error.localizedDescription
} }
} }
@ -199,7 +213,11 @@ struct FileImportView: View {
if let fileContent { if let fileContent {
do { do {
try await _startImport(fileContent: fileContent, allTournaments: true) try await _startImport(fileContent: fileContent, allTournaments: true)
} catch let error as StoreError {
Logger.error(error)
apiError = error
} catch { } catch {
Logger.error(error)
errorMessage = error.localizedDescription errorMessage = error.localizedDescription
} }
} }
@ -306,7 +324,11 @@ struct FileImportView: View {
if let fileContent { if let fileContent {
do { do {
try await _startImport(fileContent: fileContent, allTournaments: false) try await _startImport(fileContent: fileContent, allTournaments: false)
} catch let error as StoreError {
Logger.error(error)
apiError = error
} catch { } catch {
Logger.error(error)
errorMessage = error.localizedDescription errorMessage = error.localizedDescription
} }
} }
@ -381,6 +403,26 @@ struct FileImportView: View {
} }
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbarBackground(.visible, for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar)
.alert(isPresented: presentApiError, error: apiError, actions: { storeError in
switch storeError {
case .missingUsername:
Button("Créer un compte ou se connecter") {
dismiss()
navigationViewModel.selectedTab = .umpire
}
default:
Button("D'accord") {
apiError = nil
}
}
}, message: { storeError in
switch storeError {
case .missingUsername:
Text("Un compte est requis pour utiliser ce service de Padel Club, veuillez créer un compte ou vous connecter.")
default:
Text("Une erreur est survenue, veuillez réessayer plus tard.")
}
})
.sheet(isPresented: $presentFormatHelperView) { .sheet(isPresented: $presentFormatHelperView) {
NavigationStack { NavigationStack {
List { List {
@ -434,6 +476,9 @@ struct FileImportView: View {
fileContent = try String(contentsOf: selectedFile) fileContent = try String(contentsOf: selectedFile)
} }
selectedFile.stopAccessingSecurityScopedResource() selectedFile.stopAccessingSecurityScopedResource()
} catch let error as StoreError {
Logger.error(error)
apiError = error
} catch { } catch {
Logger.error(error) Logger.error(error)
errorMessage = error.localizedDescription errorMessage = error.localizedDescription
@ -453,6 +498,7 @@ struct FileImportView: View {
do { do {
fileContent = try String(contentsOf: url) fileContent = try String(contentsOf: url)
} catch { } catch {
Logger.error(error)
errorMessage = error.localizedDescription errorMessage = error.localizedDescription
} }
} }

@ -285,6 +285,7 @@ struct InscriptionManagerView: View {
}) { }) {
NavigationStack { NavigationStack {
FileImportView(defaultFileProvider: tournament.isAnimation() ? .custom : .frenchFederation) FileImportView(defaultFileProvider: tournament.isAnimation() ? .custom : .frenchFederation)
.environment(navigation)
} }
.tint(.master) .tint(.master)
} }

Loading…
Cancel
Save