improve sentences

paca_championship
Raz 11 months ago
parent 2c1b00c4cf
commit 07a0b632f9
  1. 57
      PadelClub/Data/Tournament.swift
  2. 23
      PadelClub/Views/Tournament/Screen/Components/TournamentGeneralSettingsView.swift
  3. 83
      PadelClub/Views/Tournament/Screen/RegisrationSetupView.swift

@ -2459,6 +2459,63 @@ defer {
})
}
func getOnlineRegistrationStatus() -> OnlineRegistrationStatus {
if supposedlyInProgress() {
return .inProgress
}
if closedRegistrationDate != nil {
return .ended
}
if endDate != nil {
return .endedWithResults
}
let now = Date()
if let openingRegistrationDate = openingRegistrationDate {
let timezonedDateTime = openingRegistrationDate // Assuming dates are already in local timezone
if now < timezonedDateTime {
return .notStarted
}
}
if let registrationDateLimit = registrationDateLimit {
let timezonedDateTime = registrationDateLimit // Assuming dates are already in local timezone
if now > timezonedDateTime {
return .ended
}
}
if let targetTeamCount = targetTeamCount {
// Get all team registrations excluding walk_outs
let currentTeamCount = unsortedTeamsWithoutWO().count
if currentTeamCount >= targetTeamCount {
if let waitingListLimit = waitingListLimit {
let waitingListCount = currentTeamCount - targetTeamCount
if waitingListCount >= waitingListLimit {
return .waitingListFull
}
return .waitingListPossible
}
return .registrationFull
}
let nonWalkoutTeamCount = currentTeamCount
if nonWalkoutTeamCount >= targetTeamCount {
if let waitingListLimit = waitingListLimit {
let waitingListCount = nonWalkoutTeamCount - targetTeamCount
if waitingListCount >= waitingListLimit {
return .waitingListFull
}
return .waitingListPossible
}
return .registrationFull
}
}
return .open
}
// MARK: -

@ -81,6 +81,29 @@ struct TournamentGeneralSettingsView: View {
Text("Si vous souhaitez que Padel Club vous aide à suivre les encaissements, indiquer un prix d'inscription. Sinon Padel Club vous aidera à suivre simplement l'arrivée et la présence des joueurs.")
}
Section {
NavigationLink {
RegisrationSetupView(tournament: tournament)
} label: {
LabeledContent {
if tournament.enableOnlineRegistration {
Text("activée").foregroundStyle(.green)
.font(.headline)
} else {
Text("désactivée").foregroundStyle(.logoRed)
.font(.headline)
}
} label: {
Text("Accéder aux paramètres")
Text(tournament.getOnlineRegistrationStatus().statusLocalized())
}
}
} header: {
Text("Inscription en ligne")
} footer: {
Text("Paramétrez les possibilités d'inscription en ligne à votre tournoi via Padel Club")
}
Section {
TournamentLevelPickerView()
}

@ -82,13 +82,15 @@ struct RegisrationSetupView: View {
Toggle(isOn: $enableOnlineRegistration) {
Text("Inscription en ligne")
}
} footer: {
Text("Les inscriptions en ligne permettent à des joueurs de s'inscrire à votre tournoi en passant par le site Padel Club. Vous verrez alors votre liste d'inscription s'agrandir dans la vue Gestion des Inscriptions de l'application.")
}
if enableOnlineRegistration {
Section {
Toggle(isOn: $openingRegistrationDateEnabled) {
Text("Date d'ouverture des inscriptions")
Text("Définir une date")
}
if openingRegistrationDateEnabled {
@ -99,12 +101,12 @@ struct RegisrationSetupView: View {
} header: {
Text("Date d'ouverture des inscriptions")
} footer: {
Text("Activez et définissez une date d'ouverture pour les inscriptions au tournoi.")
Text("Activez et définissez une date d'ouverture pour les inscriptions au tournoi. Les inscriptions en ligne ne seront possible qu'à partir de cette date.")
}
Section {
Toggle(isOn: $registrationDateLimitEnabled) {
Text("Activer une limite")
Text("Définir une date")
}
if registrationDateLimitEnabled {
@ -115,35 +117,35 @@ struct RegisrationSetupView: View {
} header: {
Text("Date de fermeture des inscriptions")
} footer: {
Text("Activez et définissez une date limite pour l'inscription en ligne.")
Text("Si une date de fermeture des inscriptions en ligne est définie, alors plus aucune inscription ne sera possible après cette date. Sinon, la date du début du tournoi ou la date de clôture des inscriptions seront utilisées.")
}
Section {
Toggle(isOn: $targetTeamCountEnabled) {
Text("Nombre d'équipes cible")
Text("Activer une limite")
}
if targetTeamCountEnabled {
StepperView(count: $targetTeamCount, minimum: 4)
}
} header: {
Text("Nombre d'équipes cible")
Text("Paires admises")
} footer: {
Text("Activez et définissez le nombre d'équipes cible pour le tournoi.")
Text("Si une limite de paire existe, les inscriptions seront indiqués en attente pour les joueurs au-délà de cette limite dans le cas où aucune limite de liste d'attente n'est active ou non atteinte. Dans le cas contraire, plus aucune inscription ne seront possibles.")
}
Section {
Toggle(isOn: $waitingListLimitEnabled) {
Text("Limite de la liste d'attente")
Text("Activer une limite")
}
if waitingListLimitEnabled {
StepperView(count: $waitingListLimit, minimum: 0)
StepperView(count: $waitingListLimit, minimum: 1)
}
} header: {
Text("Limite de la liste d'attente")
Text("Liste d'attente")
} footer: {
Text("Activez et définissez une limite pour la liste d'attente des équipes.")
Text("Si une limite à la liste d'attente existe, les inscriptions ne seront plus possibles une fois la liste d'attente pleine. Si aucune limite de liste d'attente n'est active, alors les inscriptions seront toujours possibles. Les joueurs auront une indication comme quoi ils sont en liste d'attente.")
}
if tournament.isAnimation() {
@ -295,3 +297,62 @@ struct RegisrationSetupView: View {
dismiss()
}
}
enum OnlineRegistrationStatus: Int {
case open = 1
case notEnabled = 2
case notStarted = 3
case ended = 4
case registrationFull = 5
case waitingListPossible = 6
case waitingListFull = 7
case inProgress = 8
case endedWithResults = 9
var displayName: String {
switch self {
case .open:
return "Open"
case .notEnabled:
return "Not Enabled"
case .notStarted:
return "Not Started"
case .ended:
return "Ended"
case .registrationFull:
return "Registration Full"
case .waitingListPossible:
return "Waiting List Possible"
case .waitingListFull:
return "Waiting List Full"
case .inProgress:
return "In Progress"
case .endedWithResults:
return "Ended with Results"
}
}
func statusLocalized() -> String {
switch self {
case .open:
return "Inscription ouverte"
case .notEnabled:
return "Inscription désactivée"
case .notStarted:
return "Inscription pas encore ouverte"
case .ended:
return "Inscription terminée"
case .registrationFull:
return "Inscription complète"
case .waitingListPossible:
return "Liste d'attente disponible"
case .waitingListFull:
return "Liste d'attente complète"
case .inProgress:
return "Tournoi en cours"
case .endedWithResults:
return "Tournoi terminé"
}
}
}

Loading…
Cancel
Save