|
|
|
|
@ -166,6 +166,7 @@ public enum TournamentDifficulty { |
|
|
|
|
|
|
|
|
|
public enum FederalTournamentAge: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
case unlisted = 0 |
|
|
|
|
case a09_10 = 100 |
|
|
|
|
case a11_12 = 120 |
|
|
|
|
case a13_14 = 140 |
|
|
|
|
case a15_16 = 160 |
|
|
|
|
@ -184,6 +185,8 @@ public enum FederalTournamentAge: Int, Hashable, Codable, CaseIterable, Identifi |
|
|
|
|
switch self { |
|
|
|
|
case .unlisted: |
|
|
|
|
return (nil, nil) |
|
|
|
|
case .a09_10: |
|
|
|
|
return (year - 10, year - 9) |
|
|
|
|
case .a11_12: |
|
|
|
|
return (year - 12, year - 11) |
|
|
|
|
case .a13_14: |
|
|
|
|
@ -205,6 +208,8 @@ public enum FederalTournamentAge: Int, Hashable, Codable, CaseIterable, Identifi |
|
|
|
|
switch self { |
|
|
|
|
case .unlisted: |
|
|
|
|
return "Animation" |
|
|
|
|
case .a09_10: |
|
|
|
|
return "09/10 ans" |
|
|
|
|
case .a11_12: |
|
|
|
|
return "11/12 ans" |
|
|
|
|
case .a13_14: |
|
|
|
|
@ -241,6 +246,8 @@ public enum FederalTournamentAge: Int, Hashable, Codable, CaseIterable, Identifi |
|
|
|
|
public var order: Int { |
|
|
|
|
switch self { |
|
|
|
|
case .unlisted: |
|
|
|
|
return 8 |
|
|
|
|
case .a09_10: |
|
|
|
|
return 7 |
|
|
|
|
case .a11_12: |
|
|
|
|
return 6 |
|
|
|
|
@ -263,6 +270,8 @@ public enum FederalTournamentAge: Int, Hashable, Codable, CaseIterable, Identifi |
|
|
|
|
switch self { |
|
|
|
|
case .unlisted: |
|
|
|
|
return displayStyle == .title ? "Aucune" : "" |
|
|
|
|
case .a09_10: |
|
|
|
|
return "U10" |
|
|
|
|
case .a11_12: |
|
|
|
|
return "U12" |
|
|
|
|
case .a13_14: |
|
|
|
|
@ -289,14 +298,16 @@ public enum FederalTournamentAge: Int, Hashable, Codable, CaseIterable, Identifi |
|
|
|
|
switch self { |
|
|
|
|
case .unlisted: |
|
|
|
|
return true |
|
|
|
|
case .a09_10: |
|
|
|
|
return age < 11 |
|
|
|
|
case .a11_12: |
|
|
|
|
return age < 13 |
|
|
|
|
case .a13_14: |
|
|
|
|
return age < 15 |
|
|
|
|
case .a15_16: |
|
|
|
|
return age < 17 |
|
|
|
|
return age < 17 && age >= 11 |
|
|
|
|
case .a17_18: |
|
|
|
|
return age < 19 |
|
|
|
|
return age < 19 && age >= 11 |
|
|
|
|
case .senior: |
|
|
|
|
return age >= 11 |
|
|
|
|
case .a45: |
|
|
|
|
@ -310,6 +321,8 @@ public enum FederalTournamentAge: Int, Hashable, Codable, CaseIterable, Identifi |
|
|
|
|
switch self { |
|
|
|
|
case .unlisted: |
|
|
|
|
return false |
|
|
|
|
case .a09_10: |
|
|
|
|
return true |
|
|
|
|
case .a11_12: |
|
|
|
|
return true |
|
|
|
|
case .a13_14: |
|
|
|
|
@ -326,6 +339,42 @@ public enum FederalTournamentAge: Int, Hashable, Codable, CaseIterable, Identifi |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func minimumNumberOfTeams(inCategory category: TournamentCategory, andInLevel level: TournamentLevel) -> Int { |
|
|
|
|
|
|
|
|
|
if self.isChildCategory() { |
|
|
|
|
if level == .p250, category == .men { |
|
|
|
|
return 8 |
|
|
|
|
} |
|
|
|
|
return 4 |
|
|
|
|
} else { |
|
|
|
|
switch level { |
|
|
|
|
case .p25, .p100, .p250: |
|
|
|
|
if category == .women { |
|
|
|
|
return 4 |
|
|
|
|
} |
|
|
|
|
if level == .p100 { |
|
|
|
|
return 8 |
|
|
|
|
} |
|
|
|
|
return 12 |
|
|
|
|
case .p500: |
|
|
|
|
if category == .women { |
|
|
|
|
return 8 |
|
|
|
|
} |
|
|
|
|
return 16 |
|
|
|
|
case .p1000: |
|
|
|
|
if category == .women { |
|
|
|
|
return 16 |
|
|
|
|
} |
|
|
|
|
return 24 |
|
|
|
|
|
|
|
|
|
case .p1500, .p2000: |
|
|
|
|
return 24 |
|
|
|
|
default: |
|
|
|
|
return -1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public enum TournamentLevel: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
@ -432,7 +481,12 @@ public enum TournamentLevel: Int, Hashable, Codable, CaseIterable, Identifiable |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public func minimumPlayerRank(category: TournamentCategory, ageCategory: FederalTournamentAge) -> Int { |
|
|
|
|
public func minimumPlayerRank(category: TournamentCategory, ageCategory: FederalTournamentAge, seasonYear: Int) -> Int { |
|
|
|
|
|
|
|
|
|
if seasonYear == 2026, category == .mix { |
|
|
|
|
return 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch self { |
|
|
|
|
case .p25: |
|
|
|
|
switch ageCategory { |
|
|
|
|
@ -876,7 +930,28 @@ public enum TournamentCategory: Int, Hashable, Codable, CaseIterable, Identifiab |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static func femaleInMaleAssimilationAddition(_ rank: Int) -> Int { |
|
|
|
|
public static func femaleInMaleAssimilationAddition(_ rank: Int, seasonYear: Int?) -> Int { |
|
|
|
|
switch seasonYear { |
|
|
|
|
case .some(let year): |
|
|
|
|
if year < 2026 { |
|
|
|
|
switch rank { |
|
|
|
|
case 1...10: return 400 |
|
|
|
|
case 11...30: return 1000 |
|
|
|
|
case 31...60: return 2000 |
|
|
|
|
case 61...100: return 3500 |
|
|
|
|
case 101...200: return 10000 |
|
|
|
|
case 201...500: return 15000 |
|
|
|
|
case 501...1000: return 25000 |
|
|
|
|
case 1001...2000: return 35000 |
|
|
|
|
case 2001...3000: return 45000 |
|
|
|
|
default: |
|
|
|
|
return 50000 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
case .none: |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch rank { |
|
|
|
|
case 1...10: return 400 |
|
|
|
|
case 11...30: return 1000 |
|
|
|
|
@ -887,8 +962,10 @@ public enum TournamentCategory: Int, Hashable, Codable, CaseIterable, Identifiab |
|
|
|
|
case 501...1000: return 25000 |
|
|
|
|
case 1001...2000: return 35000 |
|
|
|
|
case 2001...3000: return 45000 |
|
|
|
|
case 3001...5000: return 55000 |
|
|
|
|
case 5001...10000: return 70000 |
|
|
|
|
default: |
|
|
|
|
return 50000 |
|
|
|
|
return 90000 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1499,7 +1576,7 @@ public enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
|
|
|
|
|
public var isFederal: Bool { |
|
|
|
|
switch self { |
|
|
|
|
case .megaTie, .twoSetsOfSuperTie, .singleSet, .singleSetDecisivePoint, .singleSetOfFourGames, .singleSetOfFourGamesDecisivePoint: |
|
|
|
|
case .megaTie, .twoSetsOfSuperTie, .singleSet, .singleSetDecisivePoint, .singleSetOfFourGamesDecisivePoint: |
|
|
|
|
return false |
|
|
|
|
default: |
|
|
|
|
return true |
|
|
|
|
@ -1525,11 +1602,11 @@ public enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
case .twoSetsOfSuperTie: |
|
|
|
|
return "G" |
|
|
|
|
case .megaTie: |
|
|
|
|
return "F" |
|
|
|
|
return "H" |
|
|
|
|
case .singleSet: |
|
|
|
|
return "H1" |
|
|
|
|
return "I1" |
|
|
|
|
case .singleSetDecisivePoint: |
|
|
|
|
return "H2" |
|
|
|
|
return "I2" |
|
|
|
|
case .twoSetsDecisivePoint: |
|
|
|
|
return "A2" |
|
|
|
|
case .twoSetsDecisivePointSuperTie: |
|
|
|
|
@ -1539,9 +1616,9 @@ public enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
case .nineGamesDecisivePoint: |
|
|
|
|
return "D2" |
|
|
|
|
case .singleSetOfFourGames: |
|
|
|
|
return "I1" |
|
|
|
|
return "F1" |
|
|
|
|
case .singleSetOfFourGamesDecisivePoint: |
|
|
|
|
return "I2" |
|
|
|
|
return "F2" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|