|
|
|
@ -1152,6 +1152,9 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
case twoSetsOfSuperTie |
|
|
|
case twoSetsOfSuperTie |
|
|
|
case singleSet |
|
|
|
case singleSet |
|
|
|
case singleSetDecisivePoint |
|
|
|
case singleSetDecisivePoint |
|
|
|
|
|
|
|
case singleSetOfFourGames |
|
|
|
|
|
|
|
case singleSetOfFourGamesDecisivePoint |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init?(rawValue: Int?) { |
|
|
|
init?(rawValue: Int?) { |
|
|
|
guard let value = rawValue else { return nil } |
|
|
|
guard let value = rawValue else { return nil } |
|
|
|
@ -1180,6 +1183,8 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
return 6 |
|
|
|
return 6 |
|
|
|
case .singleSet, .singleSetDecisivePoint: |
|
|
|
case .singleSet, .singleSetDecisivePoint: |
|
|
|
return 7 |
|
|
|
return 7 |
|
|
|
|
|
|
|
case .singleSetOfFourGames, .singleSetOfFourGamesDecisivePoint: |
|
|
|
|
|
|
|
return 8 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1209,6 +1214,8 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
return 6 |
|
|
|
return 6 |
|
|
|
case .singleSet, .singleSetDecisivePoint: |
|
|
|
case .singleSet, .singleSetDecisivePoint: |
|
|
|
return 7 |
|
|
|
return 7 |
|
|
|
|
|
|
|
case .singleSetOfFourGames, .singleSetOfFourGamesDecisivePoint: |
|
|
|
|
|
|
|
return 8 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1224,7 +1231,7 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static var allCases: [MatchFormat] { |
|
|
|
static var allCases: [MatchFormat] { |
|
|
|
[.twoSets, .twoSetsDecisivePoint, .twoSetsSuperTie, .twoSetsDecisivePointSuperTie, .twoSetsOfFourGames, .twoSetsOfFourGamesDecisivePoint, .nineGames, .nineGamesDecisivePoint, .superTie, .megaTie, .twoSetsOfSuperTie, .singleSet, .singleSetDecisivePoint] |
|
|
|
[.twoSets, .twoSetsDecisivePoint, .twoSetsSuperTie, .twoSetsDecisivePointSuperTie, .twoSetsOfFourGames, .twoSetsOfFourGamesDecisivePoint, .nineGames, .nineGamesDecisivePoint, .superTie, .megaTie, .twoSetsOfSuperTie, .singleSet, .singleSetDecisivePoint, .singleSetOfFourGames, .singleSetOfFourGamesDecisivePoint] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func winner(scoreTeamOne: Int, scoreTeamTwo: Int) -> TeamPosition { |
|
|
|
func winner(scoreTeamOne: Int, scoreTeamTwo: Int) -> TeamPosition { |
|
|
|
@ -1237,7 +1244,7 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
|
|
|
|
|
|
|
var canSuperTie: Bool { |
|
|
|
var canSuperTie: Bool { |
|
|
|
switch self { |
|
|
|
switch self { |
|
|
|
case .twoSetsSuperTie, .twoSetsOfFourGames, .twoSetsOfFourGamesDecisivePoint, .twoSetsDecisivePointSuperTie: |
|
|
|
case .twoSetsSuperTie, .twoSetsOfFourGames, .twoSetsOfFourGamesDecisivePoint, .twoSetsDecisivePointSuperTie, .singleSetOfFourGames, .singleSetOfFourGamesDecisivePoint: |
|
|
|
return true |
|
|
|
return true |
|
|
|
default: |
|
|
|
default: |
|
|
|
return false |
|
|
|
return false |
|
|
|
@ -1259,8 +1266,10 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
func formattedEstimatedBreakDuration() -> String { |
|
|
|
func formattedEstimatedBreakDuration() -> String { |
|
|
|
var label = Duration.seconds(breakTime.breakTime * 60).formatted(.units(allowed: [.minutes])) |
|
|
|
var label = Duration.seconds(breakTime.breakTime * 60).formatted(.units(allowed: [.minutes])) |
|
|
|
if breakTime.matchCount > 1 { |
|
|
|
if breakTime.matchCount > 1 { |
|
|
|
label += " après \(breakTime.matchCount) match" |
|
|
|
label += " de pause après \(breakTime.matchCount) match" |
|
|
|
label += breakTime.matchCount.pluralSuffix |
|
|
|
label += breakTime.matchCount.pluralSuffix |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
label += " de pause" |
|
|
|
} |
|
|
|
} |
|
|
|
return label |
|
|
|
return label |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1293,6 +1302,10 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
return 30 |
|
|
|
return 30 |
|
|
|
case .singleSetDecisivePoint: |
|
|
|
case .singleSetDecisivePoint: |
|
|
|
return 25 |
|
|
|
return 25 |
|
|
|
|
|
|
|
case .singleSetOfFourGames: |
|
|
|
|
|
|
|
return 15 |
|
|
|
|
|
|
|
case .singleSetOfFourGamesDecisivePoint: |
|
|
|
|
|
|
|
return 10 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1311,10 +1324,8 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
return (30, 1) |
|
|
|
return (30, 1) |
|
|
|
case .superTie: |
|
|
|
case .superTie: |
|
|
|
return (15, 3) |
|
|
|
return (15, 3) |
|
|
|
case .megaTie: |
|
|
|
default: |
|
|
|
return (5, 1) |
|
|
|
return (5, 1) |
|
|
|
case .twoSetsOfSuperTie, .singleSet, .singleSetDecisivePoint: |
|
|
|
|
|
|
|
return (10, 1) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1326,16 +1337,16 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
return matchCount < 6 ? 3 : 0 |
|
|
|
return matchCount < 6 ? 3 : 0 |
|
|
|
case .twoSetsOfFourGames, .twoSetsOfFourGamesDecisivePoint, .nineGames, .nineGamesDecisivePoint: |
|
|
|
case .twoSetsOfFourGames, .twoSetsOfFourGamesDecisivePoint, .nineGames, .nineGamesDecisivePoint: |
|
|
|
return matchCount < 7 ? 6 : 2 |
|
|
|
return matchCount < 7 ? 6 : 2 |
|
|
|
case .superTie, .twoSetsOfSuperTie, .singleSet, .singleSetDecisivePoint: |
|
|
|
case .superTie: |
|
|
|
return 7 |
|
|
|
|
|
|
|
case .megaTie: |
|
|
|
|
|
|
|
return 7 |
|
|
|
return 7 |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
return 10 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var hasDecisivePoint: Bool { |
|
|
|
var hasDecisivePoint: Bool { |
|
|
|
switch self { |
|
|
|
switch self { |
|
|
|
case .nineGamesDecisivePoint, .twoSetsDecisivePoint, .twoSetsOfFourGamesDecisivePoint, .twoSetsDecisivePointSuperTie, .singleSetDecisivePoint: |
|
|
|
case .nineGamesDecisivePoint, .twoSetsDecisivePoint, .twoSetsOfFourGamesDecisivePoint, .twoSetsDecisivePointSuperTie, .singleSetDecisivePoint, .singleSetOfFourGamesDecisivePoint: |
|
|
|
return true |
|
|
|
return true |
|
|
|
default: |
|
|
|
default: |
|
|
|
return false |
|
|
|
return false |
|
|
|
@ -1377,7 +1388,7 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
|
|
|
|
|
|
|
var isFederal: Bool { |
|
|
|
var isFederal: Bool { |
|
|
|
switch self { |
|
|
|
switch self { |
|
|
|
case .megaTie, .twoSetsOfSuperTie, .singleSet, .singleSetDecisivePoint: |
|
|
|
case .megaTie, .twoSetsOfSuperTie, .singleSet, .singleSetDecisivePoint, .singleSetOfFourGames, .singleSetOfFourGamesDecisivePoint: |
|
|
|
return false |
|
|
|
return false |
|
|
|
default: |
|
|
|
default: |
|
|
|
return true |
|
|
|
return true |
|
|
|
@ -1415,6 +1426,10 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
return "C2" |
|
|
|
return "C2" |
|
|
|
case .nineGamesDecisivePoint: |
|
|
|
case .nineGamesDecisivePoint: |
|
|
|
return "D2" |
|
|
|
return "D2" |
|
|
|
|
|
|
|
case .singleSetOfFourGames: |
|
|
|
|
|
|
|
return "I1" |
|
|
|
|
|
|
|
case .singleSetOfFourGamesDecisivePoint: |
|
|
|
|
|
|
|
return "I2" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1436,6 +1451,8 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
return "supertie de 10 points" |
|
|
|
return "supertie de 10 points" |
|
|
|
case .megaTie: |
|
|
|
case .megaTie: |
|
|
|
return "supertie de 15 points" |
|
|
|
return "supertie de 15 points" |
|
|
|
|
|
|
|
case .singleSetOfFourGames, .singleSetOfFourGamesDecisivePoint: |
|
|
|
|
|
|
|
return "1 set de 4 jeux, tiebreak à 4/4" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1455,7 +1472,7 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
switch self { |
|
|
|
switch self { |
|
|
|
case .twoSets, .twoSetsSuperTie, .twoSetsOfFourGames, .twoSetsDecisivePoint, .twoSetsOfFourGamesDecisivePoint, .twoSetsDecisivePointSuperTie, .twoSetsOfSuperTie: |
|
|
|
case .twoSets, .twoSetsSuperTie, .twoSetsOfFourGames, .twoSetsDecisivePoint, .twoSetsOfFourGamesDecisivePoint, .twoSetsDecisivePointSuperTie, .twoSetsOfSuperTie: |
|
|
|
return 2 |
|
|
|
return 2 |
|
|
|
case .nineGames, .nineGamesDecisivePoint, .superTie, .megaTie, .singleSet, .singleSetDecisivePoint: |
|
|
|
case .nineGames, .nineGamesDecisivePoint, .superTie, .megaTie, .singleSet, .singleSetDecisivePoint, .singleSetOfFourGames, .singleSetOfFourGamesDecisivePoint: |
|
|
|
return 1 |
|
|
|
return 1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1464,7 +1481,7 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
switch self { |
|
|
|
switch self { |
|
|
|
case .twoSets, .twoSetsSuperTie, .twoSetsDecisivePoint, .twoSetsDecisivePointSuperTie, .singleSet, .singleSetDecisivePoint: |
|
|
|
case .twoSets, .twoSetsSuperTie, .twoSetsDecisivePoint, .twoSetsDecisivePointSuperTie, .singleSet, .singleSetDecisivePoint: |
|
|
|
return .six |
|
|
|
return .six |
|
|
|
case .twoSetsOfFourGames, .twoSetsOfFourGamesDecisivePoint: |
|
|
|
case .twoSetsOfFourGames, .twoSetsOfFourGamesDecisivePoint, .singleSetOfFourGames, .singleSetOfFourGamesDecisivePoint: |
|
|
|
return .four |
|
|
|
return .four |
|
|
|
case .nineGames, .nineGamesDecisivePoint: |
|
|
|
case .nineGames, .nineGamesDecisivePoint: |
|
|
|
return .nine |
|
|
|
return .nine |
|
|
|
|