@ -1394,20 +1394,28 @@ defer {
return TournamentStatus ( label : label , completion : completionLabel )
return TournamentStatus ( label : label , completion : completionLabel )
}
}
func bracketStatus ( ) async -> ( status : String , cut : TeamRegistration . TeamRange ? ) {
func bracketStatus ( ) async -> ( status : String , description : String ? , cut : TeamRegistration . TeamRange ? ) {
let availableSeeds = availableSeeds ( )
let availableSeeds = availableSeeds ( )
let cut = TeamRegistration . TeamRange ( availableSeeds . first , availableSeeds . last )
var description : String ? = nil
if availableSeeds . isEmpty = = false {
if availableSeeds . isEmpty = = false {
return ( " placer \( availableSeeds . count ) têt e \( availableSeeds . count . pluralSuffix ) de série " , cut )
description = " placer \( availableSeeds . count ) équip e \( availableSeeds . count . pluralSuffix ) "
}
}
if description = = nil {
let availableQualifiedTeams = availableQualifiedTeams ( )
let availableQualifiedTeams = availableQualifiedTeams ( )
if availableQualifiedTeams . isEmpty = = false {
if availableQualifiedTeams . isEmpty = = false {
return ( " placer \( availableQualifiedTeams . count ) qualifié " + availableQualifiedTeams . count . pluralSuffix , cut )
description = " placer \( availableQualifiedTeams . count ) qualifié " + availableQualifiedTeams . count . pluralSuffix
}
}
}
var cut : TeamRegistration . TeamRange ? = nil
if description = = nil && isAnimation ( ) = = false {
cut = TeamRegistration . TeamRange ( availableSeeds . first , availableSeeds . last )
}
if let round = getActiveRound ( ) {
if let round = getActiveRound ( ) {
return ( [ round . roundTitle ( . short ) , round . roundStatus ( ) ] . joined ( separator : " " ) , cut )
return ( [ round . roundTitle ( . short ) , round . roundStatus ( ) ] . joined ( separator : " " ) . lowercased ( ) , description , cut )
} else {
} else {
return ( " à construire " , nil )
return ( " " , description , nil )
}
}
}
}
@ -1415,10 +1423,10 @@ defer {
let groupStageTeams = groupStageTeams ( )
let groupStageTeams = groupStageTeams ( )
let groupStageTeamsCount = groupStageTeams . count
let groupStageTeamsCount = groupStageTeams . count
if groupStageTeamsCount = = 0 || groupStageTeamsCount != groupStageSpots ( ) {
if groupStageTeamsCount = = 0 || groupStageTeamsCount != groupStageSpots ( ) {
return ( " à faire " , nil )
return ( " à compléter " , nil )
}
}
let cut = TeamRegistration . TeamRange ( groupStageTeams . first , groupStageTeams . last )
let cut : TeamRegistration . TeamRange ? = isAnimation ( ) ? nil : TeamRegistration . TeamRange ( groupStageTeams . first , groupStageTeams . last )
let runningGroupStages = groupStages ( ) . filter ( { $0 . isRunning ( ) } )
let runningGroupStages = groupStages ( ) . filter ( { $0 . isRunning ( ) } )
if groupStagesAreOver ( ) { return ( " terminées " , cut ) }
if groupStagesAreOver ( ) { return ( " terminées " , cut ) }
@ -1435,17 +1443,13 @@ defer {
}
}
func settingsDescriptionLocalizedLabel ( ) -> String {
func settingsDescriptionLocalizedLabel ( ) -> String {
[ dayDuration . formatted ( ) + " jour \( dayDuration . pluralSuffix ) " , courtCount . formatted ( ) + " terrain \( courtCount . pluralSuffix ) " ] . joined ( separator : " , " )
[ courtCount . formatted ( ) + " terrain \( courtCount . pluralSuffix ) " , entryFeeMessage ] . joined ( separator : " , " )
}
}
func structureDescriptionLocalizedLabel ( ) -> String {
func structureDescriptionLocalizedLabel ( ) -> String {
if state ( ) = = . initial {
return " à valider "
} else {
let groupStageLabel : String ? = groupStageCount > 0 ? groupStageCount . formatted ( ) + " poule \( groupStageCount . pluralSuffix ) " : nil
let groupStageLabel : String ? = groupStageCount > 0 ? groupStageCount . formatted ( ) + " poule \( groupStageCount . pluralSuffix ) " : nil
return [ teamCount . formatted ( ) + " équipes " , groupStageLabel ] . compactMap ( { $0 } ) . joined ( separator : " , " )
return [ teamCount . formatted ( ) + " équipes " , groupStageLabel ] . compactMap ( { $0 } ) . joined ( separator : " , " )
}
}
}
func deleteAndBuildEverything ( ) {
func deleteAndBuildEverything ( ) {
deleteStructure ( )
deleteStructure ( )