@ -30,7 +30,10 @@ final class Tournament: BaseTournament {
// }
// }
internal init ( event : String ? = nil , name : String ? = nil , startDate : Date = Date ( ) , endDate : Date ? = nil , creationDate : Date = Date ( ) , isPrivate : Bool = true , groupStageFormat : MatchFormat ? = nil , roundFormat : MatchFormat ? = nil , loserRoundFormat : MatchFormat ? = nil , groupStageSortMode : GroupStageOrderingMode , groupStageCount : Int = 4 , rankSourceDate : Date ? = nil , dayDuration : Int = 1 , teamCount : Int = 24 , teamSorting : TeamSortingType ? = nil , federalCategory : TournamentCategory , federalLevelCategory : TournamentLevel , federalAgeCategory : FederalTournamentAge , closedRegistrationDate : Date ? = nil , groupStageAdditionalQualified : Int = 0 , courtCount : Int = 2 , prioritizeClubMembers : Bool = false , qualifiedPerGroupStage : Int = 1 , teamsPerGroupStage : Int = 4 , entryFee : Double ? = nil , additionalEstimationDuration : Int = 0 , isDeleted : Bool = false , publishTeams : Bool = false , publishSummons : Bool = false , publishGroupStages : Bool = false , publishBrackets : Bool = false , shouldVerifyBracket : Bool = false , shouldVerifyGroupStage : Bool = false , hideTeamsWeight : Bool = false , publishTournament : Bool = false , hidePointsEarned : Bool = false , publishRankings : Bool = false , loserBracketMode : LoserBracketMode = . automatic , initialSeedRound : Int = 0 , initialSeedCount : Int = 0 , enableOnlineRegistration : Bool = false , registrationDateLimit : Date ? = nil , openingRegistrationDate : Date ? = nil , waitingListLimit : Int ? = nil , accountIsRequired : Bool = true , licenseIsRequired : Bool = true , minimumPlayerPerTeam : Int = 2 , maximumPlayerPerTeam : Int = 2 , information : String ? = nil ) {
internal init ( event : String ? = nil , name : String ? = nil , startDate : Date = Date ( ) , endDate : Date ? = nil , creationDate : Date = Date ( ) , isPrivate : Bool = true , groupStageFormat : MatchFormat ? = nil , roundFormat : MatchFormat ? = nil , loserRoundFormat : MatchFormat ? = nil , groupStageSortMode : GroupStageOrderingMode , groupStageCount : Int = 4 , rankSourceDate : Date ? = nil , dayDuration : Int = 1 , teamCount : Int = 24 , teamSorting : TeamSortingType ? = nil , federalCategory : TournamentCategory , federalLevelCategory : TournamentLevel , federalAgeCategory : FederalTournamentAge , closedRegistrationDate : Date ? = nil , groupStageAdditionalQualified : Int = 0 , courtCount : Int = 2 , prioritizeClubMembers : Bool = false , qualifiedPerGroupStage : Int = 1 , teamsPerGroupStage : Int = 4 , entryFee : Double ? = nil , additionalEstimationDuration : Int = 0 , isDeleted : Bool = false , publishTeams : Bool = false , publishSummons : Bool = false , publishGroupStages : Bool = false , publishBrackets : Bool = false , shouldVerifyBracket : Bool = false , shouldVerifyGroupStage : Bool = false , hideTeamsWeight : Bool = false , publishTournament : Bool = false , hidePointsEarned : Bool = false , publishRankings : Bool = false , loserBracketMode : LoserBracketMode = . automatic , initialSeedRound : Int = 0 , initialSeedCount : Int = 0 , enableOnlineRegistration : Bool = false , registrationDateLimit : Date ? = nil , openingRegistrationDate : Date ? = nil , waitingListLimit : Int ? = nil , accountIsRequired : Bool = true , licenseIsRequired : Bool = true , minimumPlayerPerTeam : Int = 2 , maximumPlayerPerTeam : Int = 2 , information : String ? = nil ,
umpireCustomMail : String ? = nil ,
disableRankingFederalRuling : Bool = false
) {
super . init ( )
super . init ( )
self . event = event
self . event = event
self . name = name
self . name = name
@ -95,6 +98,8 @@ final class Tournament: BaseTournament {
self . minimumPlayerPerTeam = minimumPlayerPerTeam
self . minimumPlayerPerTeam = minimumPlayerPerTeam
self . maximumPlayerPerTeam = maximumPlayerPerTeam
self . maximumPlayerPerTeam = maximumPlayerPerTeam
self . information = information
self . information = information
self . umpireCustomMail = umpireCustomMail
self . disableRankingFederalRuling = disableRankingFederalRuling
}
}
required init ( from decoder : Decoder ) throws {
required init ( from decoder : Decoder ) throws {
@ -1133,13 +1138,7 @@ defer {
let groupStages = groupStages ( )
let groupStages = groupStages ( )
var baseRank = teamCount - groupStageSpots ( ) + qualifiedPerGroupStage * groupStageCount + groupStageAdditionalQualified
var baseRank = teamCount - groupStageSpots ( ) + qualifiedPerGroupStage * groupStageCount + groupStageAdditionalQualified
// TODO: R A Z a j o u t é u n e o p t i o n p o u r c h o i s i r e n t r e l a r è g l e o f f i c i e l e t l a r è g l e ' m a i s o n '
if disableRankingFederalRuling = = false {
/*
Request by Philippe Morin 24 / 03 / 2025
*/
let defaultOption = false
if defaultOption {
baseRank += qualifiedPerGroupStage * groupStageCount + groupStageAdditionalQualified - 1
baseRank += qualifiedPerGroupStage * groupStageCount + groupStageAdditionalQualified - 1
}
}
let alreadyPlaceTeams = Array ( teams . values . flatMap ( { $0 } ) )
let alreadyPlaceTeams = Array ( teams . values . flatMap ( { $0 } ) )
@ -1443,7 +1442,7 @@ defer {
}
}
func umpireMail ( ) -> [ String ] ? {
func umpireMail ( ) -> [ String ] ? {
return [ DataStore . shared . user . email ]
return [ umpireCustomMail ? ? DataStore . shared . user . email ]
}
}
func earnings ( ) -> Double {
func earnings ( ) -> Double {
@ -2584,11 +2583,14 @@ extension Tournament {
shouldBePrivate = false
shouldBePrivate = false
}
}
let disableRankingFederalRuling = tournaments . first ? . disableRankingFederalRuling ? ? false
let umpireCustomMail = tournaments . first ? . umpireCustomMail
let tournamentLevel = TournamentLevel . mostUsed ( inTournaments : tournaments )
let tournamentLevel = TournamentLevel . mostUsed ( inTournaments : tournaments )
let tournamentCategory = TournamentCategory . mostUsed ( inTournaments : tournaments )
let tournamentCategory = TournamentCategory . mostUsed ( inTournaments : tournaments )
let federalTournamentAge = FederalTournamentAge . mostUsed ( inTournaments : tournaments )
let federalTournamentAge = FederalTournamentAge . mostUsed ( inTournaments : tournaments )
// c r e a t o r : D a t a S t o r e . s h a r e d . u s e r ? . i d
// c r e a t o r : D a t a S t o r e . s h a r e d . u s e r ? . i d
return Tournament ( isPrivate : shouldBePrivate , groupStageSortMode : . snake , rankSourceDate : rankSourceDate , teamSorting : tournamentLevel . defaultTeamSortingType , federalCategory : tournamentCategory , federalLevelCategory : tournamentLevel , federalAgeCategory : federalTournamentAge , loserBracketMode : DataStore . shared . user . loserBracketMode )
return Tournament ( isPrivate : shouldBePrivate , groupStageSortMode : . snake , rankSourceDate : rankSourceDate , teamSorting : tournamentLevel . defaultTeamSortingType , federalCategory : tournamentCategory , federalLevelCategory : tournamentLevel , federalAgeCategory : federalTournamentAge , loserBracketMode : DataStore . shared . user . loserBracketMode , umpireCustomMail : umpireCustomMail , disableRankingFederalRuling : disableRankingFederalRuling )
}
}
static func fake ( ) -> Tournament {
static func fake ( ) -> Tournament {