|
|
|
|
@ -191,13 +191,22 @@ defer { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public func scoreLabel() -> String { |
|
|
|
|
public func scoreLabel(winnerFirst: Bool = false) -> String { |
|
|
|
|
if hasWalkoutTeam() == true { |
|
|
|
|
return "WO" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let scoreOne = teamScore(.one)?.score?.components(separatedBy: ",") ?? [] |
|
|
|
|
let scoreTwo = teamScore(.two)?.score?.components(separatedBy: ",") ?? [] |
|
|
|
|
let tuples = zip(scoreOne, scoreTwo).map { ($0, $1) } |
|
|
|
|
var tuples = zip(scoreOne, scoreTwo).map { ($0, $1) } |
|
|
|
|
|
|
|
|
|
if winnerFirst { |
|
|
|
|
if teamWon(atPosition: .one) { |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
tuples = zip(scoreTwo, scoreOne).map { ($0, $1) } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
let scores = tuples.map { $0 + "/" + $1 }.joined(separator: " ") |
|
|
|
|
return scores |
|
|
|
|
} |
|
|
|
|
@ -1066,6 +1075,10 @@ defer { |
|
|
|
|
[MatchSpot(match: self, teamPosition: .one), MatchSpot(match: self, teamPosition: .two)] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public func initialStartDate() -> Date? { |
|
|
|
|
plannedStartDate ?? startDate |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func insertOnServer() { |
|
|
|
|
self.tournamentStore?.matches.writeChangeAndInsertOnServer(instance: self) |
|
|
|
|
for teamScore in self.teamScores { |
|
|
|
|
|