|
|
|
|
@ -48,7 +48,7 @@ struct TournamentBuild: TournamentBuildHolder, Hashable, Codable, Identifiable { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var identifier: String { |
|
|
|
|
level.localizedLevelLabel()+":"+category.localizedLabel()+":"+age.localizedFederalAgeLabel() |
|
|
|
|
level.localizedLevelLabel()+":"+category.localizedCategoryLabel(ageCategory: age)+":"+age.localizedFederalAgeLabel() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func computedLabel(_ displayStyle: DisplayStyle = .wide) -> String { |
|
|
|
|
@ -57,11 +57,11 @@ struct TournamentBuild: TournamentBuildHolder, Hashable, Codable, Identifiable { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func localizedLabel(_ displayStyle: DisplayStyle = .wide) -> String { |
|
|
|
|
level.localizedLevelLabel(displayStyle) + " " + category.localizedLabel(displayStyle) |
|
|
|
|
level.localizedLevelLabel(displayStyle) + " " + category.localizedCategoryLabel(displayStyle, ageCategory: age) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func localizedTitle(_ displayStyle: DisplayStyle = .wide) -> String { |
|
|
|
|
level.localizedLevelLabel(displayStyle) + " " + category.localizedLabel(displayStyle) |
|
|
|
|
level.localizedLevelLabel(displayStyle) + " " + category.localizedCategoryLabel(displayStyle, ageCategory: age) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func localizedAge(_ displayStyle: DisplayStyle = .wide) -> String { |
|
|
|
|
@ -257,13 +257,13 @@ enum FederalTournamentAge: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
case .unlisted: |
|
|
|
|
return displayStyle == .title ? "Aucune" : "" |
|
|
|
|
case .a11_12: |
|
|
|
|
return "11/12 ans" |
|
|
|
|
return "U12" |
|
|
|
|
case .a13_14: |
|
|
|
|
return "13/14 ans" |
|
|
|
|
return "U14" |
|
|
|
|
case .a15_16: |
|
|
|
|
return "15/16 ans" |
|
|
|
|
return "U16" |
|
|
|
|
case .a17_18: |
|
|
|
|
return "17/18 ans" |
|
|
|
|
return "U18" |
|
|
|
|
case .senior: |
|
|
|
|
return displayStyle == .short ? "" : "Senior" |
|
|
|
|
case .a45: |
|
|
|
|
@ -298,6 +298,27 @@ enum FederalTournamentAge: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
return age >= 55 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func isChildCategory() -> Bool { |
|
|
|
|
switch self { |
|
|
|
|
case .unlisted: |
|
|
|
|
return false |
|
|
|
|
case .a11_12: |
|
|
|
|
return true |
|
|
|
|
case .a13_14: |
|
|
|
|
return true |
|
|
|
|
case .a15_16: |
|
|
|
|
return true |
|
|
|
|
case .a17_18: |
|
|
|
|
return true |
|
|
|
|
case .senior: |
|
|
|
|
return false |
|
|
|
|
case .a45: |
|
|
|
|
return false |
|
|
|
|
case .a55: |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
enum TournamentLevel: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
@ -395,6 +416,15 @@ enum TournamentLevel: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func haveDeadlines() -> Bool { |
|
|
|
|
switch self { |
|
|
|
|
case .p500, .p1000, .p1500, .p2000: |
|
|
|
|
return true |
|
|
|
|
default: |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func minimumPlayerRank(category: TournamentCategory, ageCategory: FederalTournamentAge) -> Int { |
|
|
|
|
switch self { |
|
|
|
|
case .p25: |
|
|
|
|
@ -909,26 +939,46 @@ enum TournamentCategory: Int, Hashable, Codable, CaseIterable, Identifiable { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func localizedLabel(_ displayStyle: DisplayStyle = .wide) -> String { |
|
|
|
|
func localizedCategoryLabel(_ displayStyle: DisplayStyle = .wide, ageCategory: FederalTournamentAge? = nil) -> String { |
|
|
|
|
switch self { |
|
|
|
|
case .unlisted: |
|
|
|
|
return displayStyle == .title ? "Aucune" : "" |
|
|
|
|
case .men: |
|
|
|
|
switch displayStyle { |
|
|
|
|
case .title: |
|
|
|
|
if ageCategory?.isChildCategory() == true { |
|
|
|
|
return "Garçons" |
|
|
|
|
} |
|
|
|
|
return "Hommes" |
|
|
|
|
case .wide: |
|
|
|
|
if ageCategory?.isChildCategory() == true { |
|
|
|
|
return "Garçons" |
|
|
|
|
} |
|
|
|
|
return "Hommes" |
|
|
|
|
case .short: |
|
|
|
|
if ageCategory?.isChildCategory() == true { |
|
|
|
|
return "G" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "H" |
|
|
|
|
} |
|
|
|
|
case .women: |
|
|
|
|
switch displayStyle { |
|
|
|
|
case .title: |
|
|
|
|
if ageCategory?.isChildCategory() == true { |
|
|
|
|
return "Filles" |
|
|
|
|
} |
|
|
|
|
return "Dames" |
|
|
|
|
case .wide: |
|
|
|
|
if ageCategory?.isChildCategory() == true { |
|
|
|
|
return "Filles" |
|
|
|
|
} |
|
|
|
|
return "Dames" |
|
|
|
|
case .short: |
|
|
|
|
if ageCategory?.isChildCategory() == true { |
|
|
|
|
return "F" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "D" |
|
|
|
|
} |
|
|
|
|
case .mix: |
|
|
|
|
|