@ -65,7 +65,13 @@ final class Tournament : ModelObject, Storable {
var openingRegistrationDate : Date ? = nil
var openingRegistrationDate : Date ? = nil
var targetTeamCount : Int ? = nil
var targetTeamCount : Int ? = nil
var waitingListLimit : Int ? = nil
var waitingListLimit : Int ? = nil
var accountIsRequired : Bool = true
var licenseIsRequired : Bool = true
var minimumPlayerPerTeam : Int = 2
var maximumPlayerPerTeam : Int = 2
var information : String ? = nil
var displayEntryFeeInformation : Bool = false
@ ObservationIgnored
@ ObservationIgnored
var navigationPath : [ Screen ] = [ ]
var navigationPath : [ Screen ] = [ ]
@ -116,10 +122,16 @@ final class Tournament : ModelObject, Storable {
case _loserBracketMode = " loserBracketMode "
case _loserBracketMode = " loserBracketMode "
case _initialSeedRound = " initialSeedRound "
case _initialSeedRound = " initialSeedRound "
case _initialSeedCount = " initialSeedCount "
case _initialSeedCount = " initialSeedCount "
case _accountIsRequired = " account_is_required "
case _licenseIsRequired = " license_is_required "
case _minimumPlayerPerTeam = " minimum_player_per_team "
case _maximumPlayerPerTeam = " maximum_player_per_team "
case _information = " information "
case _displayEntryFeeInformation = " displayEntryFeeInformation "
}
}
internal init ( event : String ? = nil , name : String ? = nil , startDate : Date = Date ( ) , endDate : Date ? = nil , creationDate : Date = Date ( ) , isPrivate : Bool = false , 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 ) {
internal init ( event : String ? = nil , name : String ? = nil , startDate : Date = Date ( ) , endDate : Date ? = nil , creationDate : Date = Date ( ) , isPrivate : Bool = false , 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 , accountIsRequired : Bool = true , licenseIsRequired : Bool = true , minimumPlayerPerTeam : Int = 2 , maximumPlayerPerTeam : Int = 2 , information : String ? = nil , displayEntryFeeInformation : Bool = false ) {
self . event = event
self . event = event
self . name = name
self . name = name
self . startDate = startDate
self . startDate = startDate
@ -173,6 +185,13 @@ final class Tournament : ModelObject, Storable {
self . loserBracketMode = loserBracketMode
self . loserBracketMode = loserBracketMode
self . initialSeedRound = initialSeedRound
self . initialSeedRound = initialSeedRound
self . initialSeedCount = initialSeedCount
self . initialSeedCount = initialSeedCount
self . accountIsRequired = accountIsRequired
self . licenseIsRequired = licenseIsRequired
self . minimumPlayerPerTeam = minimumPlayerPerTeam
self . maximumPlayerPerTeam = maximumPlayerPerTeam
self . information = information
self . displayEntryFeeInformation = displayEntryFeeInformation
}
}
@ -221,6 +240,15 @@ final class Tournament : ModelObject, Storable {
loserBracketMode = try container . decodeIfPresent ( LoserBracketMode . self , forKey : . _loserBracketMode ) ? ? . automatic
loserBracketMode = try container . decodeIfPresent ( LoserBracketMode . self , forKey : . _loserBracketMode ) ? ? . automatic
initialSeedRound = try container . decodeIfPresent ( Int . self , forKey : . _initialSeedRound ) ? ? 0
initialSeedRound = try container . decodeIfPresent ( Int . self , forKey : . _initialSeedRound ) ? ? 0
initialSeedCount = try container . decodeIfPresent ( Int . self , forKey : . _initialSeedCount ) ? ? 0
initialSeedCount = try container . decodeIfPresent ( Int . self , forKey : . _initialSeedCount ) ? ? 0
accountIsRequired = try container . decodeIfPresent ( Bool . self , forKey : . _accountIsRequired ) ? ? true
licenseIsRequired = try container . decodeIfPresent ( Bool . self , forKey : . _licenseIsRequired ) ? ? true
minimumPlayerPerTeam = try container . decodeIfPresent ( Int . self , forKey : . _minimumPlayerPerTeam ) ? ? 2
maximumPlayerPerTeam = try container . decodeIfPresent ( Int . self , forKey : . _maximumPlayerPerTeam ) ? ? 2
information = try container . decodeIfPresent ( String . self , forKey : . _information )
displayEntryFeeInformation = try container . decodeIfPresent ( Bool . self , forKey : . _displayEntryFeeInformation ) ? ? false
}
}
fileprivate static let _numberFormatter : NumberFormatter = NumberFormatter ( )
fileprivate static let _numberFormatter : NumberFormatter = NumberFormatter ( )
@ -309,6 +337,12 @@ final class Tournament : ModelObject, Storable {
try container . encode ( loserBracketMode , forKey : . _loserBracketMode )
try container . encode ( loserBracketMode , forKey : . _loserBracketMode )
try container . encode ( initialSeedRound , forKey : . _initialSeedRound )
try container . encode ( initialSeedRound , forKey : . _initialSeedRound )
try container . encode ( initialSeedCount , forKey : . _initialSeedCount )
try container . encode ( initialSeedCount , forKey : . _initialSeedCount )
try container . encode ( accountIsRequired , forKey : . _accountIsRequired )
try container . encode ( licenseIsRequired , forKey : . _licenseIsRequired )
try container . encode ( minimumPlayerPerTeam , forKey : . _minimumPlayerPerTeam )
try container . encode ( maximumPlayerPerTeam , forKey : . _maximumPlayerPerTeam )
try container . encode ( information , forKey : . _information )
try container . encode ( displayEntryFeeInformation , forKey : . _displayEntryFeeInformation )
}
}
fileprivate func _encodePayment ( container : inout KeyedEncodingContainer < CodingKeys > ) throws {
fileprivate func _encodePayment ( container : inout KeyedEncodingContainer < CodingKeys > ) throws {
@ -1019,7 +1053,7 @@ defer {
// t o d o
// t o d o
func significantPlayerCount ( ) -> Int {
func significantPlayerCount ( ) -> Int {
return 2
return minimumPlayerPerTeam
}
}
func inadequatePlayers ( in players : [ PlayerRegistration ] ) -> [ PlayerRegistration ] {
func inadequatePlayers ( in players : [ PlayerRegistration ] ) -> [ PlayerRegistration ] {