|
|
|
|
@ -56,6 +56,30 @@ final public class Round: BaseRound, SideStorable { |
|
|
|
|
return tournamentStore.matches.filter { $0.round == self.id && $0.disabled == true } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public func setData(from correspondingRound: Round, tournamentStartDate: Date, previousTournamentStartDate: Date) { |
|
|
|
|
let matches = correspondingRound._matches() |
|
|
|
|
for (index, match) in self._matches().enumerated() { |
|
|
|
|
match.setData(from: matches[index], tournamentStartDate: tournamentStartDate, previousTournamentStartDate: previousTournamentStartDate) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
self.matchFormat = correspondingRound.matchFormat |
|
|
|
|
if let correspondingPlannedStartDate = correspondingRound.plannedStartDate { |
|
|
|
|
let offset = correspondingPlannedStartDate.timeIntervalSince(previousTournamentStartDate) |
|
|
|
|
self.startDate = tournamentStartDate.addingTimeInterval(offset) |
|
|
|
|
} |
|
|
|
|
self.loserBracketMode = correspondingRound.loserBracketMode |
|
|
|
|
self.groupStageLoserBracket = correspondingRound.groupStageLoserBracket |
|
|
|
|
|
|
|
|
|
loserRounds().forEach { round in |
|
|
|
|
|
|
|
|
|
if let pRound = correspondingRound.loserRounds().first(where: { r in |
|
|
|
|
r.index == round.index |
|
|
|
|
}) { |
|
|
|
|
round.setData(from: pRound, tournamentStartDate: tournamentStartDate, previousTournamentStartDate: previousTournamentStartDate) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// MARK: - |
|
|
|
|
|
|
|
|
|
public var matchFormat: MatchFormat { |
|
|
|
|
|