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. 44
      PadelClub/Views/Navigation/Agenda/TournamentLookUpView.swift
  7. 2
      PadelClub/Views/Player/PlayerDetailView.swift
  8. 2
      PadelClub/Views/Team/EditingTeamView.swift
  9. 48
      PadelClub/Views/Tournament/FileImportView.swift
  10. 1
      PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift

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

@ -132,6 +132,6 @@ extension ImportedPlayer: PlayerHolder {
fileprivate extension 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 {
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) {
return true
} else {

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

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

@ -9,10 +9,12 @@ import SwiftUI
import CoreLocation
import CoreLocationUI
import PadelClubData
import LeStorage
struct TournamentLookUpView: View {
@EnvironmentObject var dataStore: DataStore
@Environment(FederalDataViewModel.self) var federalDataViewModel: FederalDataViewModel
@Environment(NavigationViewModel.self) var navigationViewModel: NavigationViewModel
@StateObject var locationManager = LocationManager()
@Environment(\.dismiss) private var dismiss
@FocusState private var isFocused: Bool
@ -27,11 +29,20 @@ struct TournamentLookUpView: View {
@State private var presentAlert: Bool = false
@State private var confirmSearch: Bool = false
@State private var locationRequested = false
@State private var apiError: StoreError?
var tournaments: [FederalTournament] {
federalDataViewModel.searchedFederalTournaments
}
var presentApiError: Binding<Bool> {
Binding {
apiError != nil
} set: { value in
}
}
var showLastError: Binding<Bool> {
Binding {
locationManager.lastError != nil
@ -70,6 +81,26 @@ struct TournamentLookUpView: View {
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: {
Button {
presentAlert = false
@ -79,7 +110,10 @@ struct TournamentLookUpView: View {
Task {
await getNewPage()
searching = false
dismiss()
if apiError == nil {
dismiss()
}
}
} label: {
Label("Tout voir", systemImage: "arrow.down.circle")
@ -232,7 +266,7 @@ struct TournamentLookUpView: View {
searching = false
if tournaments.isEmpty == false && tournaments.count < total && total >= 200 && requestedToGetAllPages == false {
presentAlert = true
} else {
} else if apiError == nil {
dismiss()
}
}
@ -294,7 +328,9 @@ struct TournamentLookUpView: View {
} else {
print("finished")
}
} catch let error as StoreError {
print("getNewPage", error)
apiError = error
} catch {
print("getNewPage", error)
}

@ -157,7 +157,7 @@ struct PlayerDetailView: View {
}
} else if player.isMalePlayer() == false && tournament.tournamentCategory == .men, let rank = player.rank {
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 {
Text(value.formatted())
} label: {

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

@ -64,6 +64,7 @@ enum FileImportCustomField: Int, Identifiable, CaseIterable {
struct FileImportView: View {
@EnvironmentObject var dataStore: DataStore
@Environment(NavigationViewModel.self) var navigationViewModel: NavigationViewModel
@Environment(Tournament.self) var tournament: Tournament
@Environment(\.dismiss) private var dismiss
@ -84,7 +85,16 @@ struct FileImportView: View {
@State private var presentFormatHelperView: Bool = false
@State private var validatedTournamentIds: Set<String> = Set()
@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 {
var id: Int { self.rawValue }
case byParameter
@ -175,7 +185,11 @@ struct FileImportView: View {
if let fileContent {
do {
try await _startImport(fileContent: fileContent, allTournaments: false)
} catch let error as StoreError {
Logger.error(error)
apiError = error
} catch {
Logger.error(error)
errorMessage = error.localizedDescription
}
}
@ -199,7 +213,11 @@ struct FileImportView: View {
if let fileContent {
do {
try await _startImport(fileContent: fileContent, allTournaments: true)
} catch let error as StoreError {
Logger.error(error)
apiError = error
} catch {
Logger.error(error)
errorMessage = error.localizedDescription
}
}
@ -306,7 +324,11 @@ struct FileImportView: View {
if let fileContent {
do {
try await _startImport(fileContent: fileContent, allTournaments: false)
} catch let error as StoreError {
Logger.error(error)
apiError = error
} catch {
Logger.error(error)
errorMessage = error.localizedDescription
}
}
@ -381,6 +403,26 @@ struct FileImportView: View {
}
.navigationBarTitleDisplayMode(.inline)
.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) {
NavigationStack {
List {
@ -434,6 +476,9 @@ struct FileImportView: View {
fileContent = try String(contentsOf: selectedFile)
}
selectedFile.stopAccessingSecurityScopedResource()
} catch let error as StoreError {
Logger.error(error)
apiError = error
} catch {
Logger.error(error)
errorMessage = error.localizedDescription
@ -453,6 +498,7 @@ struct FileImportView: View {
do {
fileContent = try String(contentsOf: url)
} catch {
Logger.error(error)
errorMessage = error.localizedDescription
}
}

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

Loading…
Cancel
Save