|
|
|
|
@ -600,7 +600,7 @@ final class TeamRegistration: ModelObject, Storable { |
|
|
|
|
|
|
|
|
|
func wildcardLabel() -> String? { |
|
|
|
|
if isWildCard() { |
|
|
|
|
let wildcardLabel: String = ["wildcard", (wildCardBracket ? "tableau" : "poule")].joined(separator: " ") |
|
|
|
|
let wildcardLabel: String = ["Wildcard", (wildCardBracket ? "Tableau" : "Poule")].joined(separator: " ") |
|
|
|
|
return wildcardLabel |
|
|
|
|
} else { |
|
|
|
|
return nil |
|
|
|
|
@ -647,22 +647,48 @@ final class TeamRegistration: ModelObject, Storable { |
|
|
|
|
unsortedPlayers().count > 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func bracketMatchTitleAndQualifiedStatus() -> String? { |
|
|
|
|
let v = groupStageObject()?.groupStageTitle() |
|
|
|
|
var base = "Qualifié" |
|
|
|
|
if qualified { |
|
|
|
|
if let groupStageTitle = groupStageObject()?.groupStageTitle() { |
|
|
|
|
base = base + " (\(groupStageTitle))" |
|
|
|
|
} |
|
|
|
|
func teamInitialPositionBracket() -> String? { |
|
|
|
|
let round = initialMatch()?.roundAndMatchTitle() |
|
|
|
|
if let round { |
|
|
|
|
return round |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let suffix = qualified ? nil : groupStageObject()?.groupStageTitle() |
|
|
|
|
let initalMatchTitle = initialMatch()?.roundAndMatchTitle() ?? suffix |
|
|
|
|
let values = [qualified ? base : nil, initalMatchTitle].compactMap({ $0 }) |
|
|
|
|
if values.isEmpty { |
|
|
|
|
return nil |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func teamInitialPositionGroupStage() -> String? { |
|
|
|
|
let groupStage = self.groupStageObject() |
|
|
|
|
let group = groupStage?.groupStageTitle(.title) |
|
|
|
|
var groupPositionLabel: String? = nil |
|
|
|
|
if let finalPosition = groupStage?.finalPosition(ofTeam: self) { |
|
|
|
|
groupPositionLabel = (finalPosition + 1).ordinalFormatted() |
|
|
|
|
} else if let groupStagePosition { |
|
|
|
|
groupPositionLabel = "\(groupStagePosition + 1)" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if let group { |
|
|
|
|
if let groupPositionLabel { |
|
|
|
|
return [group, "#\(groupPositionLabel)"].joined(separator: " ") |
|
|
|
|
} else { |
|
|
|
|
return group |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func qualifiedStatus(hideBracketStatus: Bool = false) -> String? { |
|
|
|
|
let teamInitialPositionBracket = teamInitialPositionBracket() |
|
|
|
|
let groupStageTitle = teamInitialPositionGroupStage() |
|
|
|
|
|
|
|
|
|
let base: String? = qualified ? "Qualifié" : nil |
|
|
|
|
if let groupStageTitle, let teamInitialPositionBracket, hideBracketStatus == false { |
|
|
|
|
return [base, groupStageTitle, ">", teamInitialPositionBracket].compactMap({ $0 }).joined(separator: " ") |
|
|
|
|
} else if let groupStageTitle { |
|
|
|
|
return [base, groupStageTitle].compactMap({ $0 }).joined(separator: " ") |
|
|
|
|
} else if hideBracketStatus == false { |
|
|
|
|
return teamInitialPositionBracket |
|
|
|
|
} |
|
|
|
|
return values.joined(separator: " -> ") |
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
enum CodingKeys: String, CodingKey { |
|
|
|
|
|