|
|
|
@ -2415,27 +2415,42 @@ defer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func removeAllSeeds() async { |
|
|
|
func removeAllSeeds() async { |
|
|
|
unsortedTeams().forEach({ team in |
|
|
|
let teams = unsortedTeams() |
|
|
|
|
|
|
|
teams.forEach({ team in |
|
|
|
team.bracketPosition = nil |
|
|
|
team.bracketPosition = nil |
|
|
|
|
|
|
|
team._cachedRestingTime = nil |
|
|
|
}) |
|
|
|
}) |
|
|
|
let ts = allRoundMatches().flatMap { match in |
|
|
|
let allMatches = allRoundMatches() |
|
|
|
|
|
|
|
let ts = allMatches.flatMap { match in |
|
|
|
match.teamScores |
|
|
|
match.teamScores |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
allMatches.forEach { match in |
|
|
|
|
|
|
|
match.disabled = false |
|
|
|
|
|
|
|
match.losingTeamId = nil |
|
|
|
|
|
|
|
match.winningTeamId = nil |
|
|
|
|
|
|
|
match.endDate = nil |
|
|
|
|
|
|
|
match.removeCourt() |
|
|
|
|
|
|
|
match.servingTeamId = nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
do { |
|
|
|
try tournamentStore.teamScores.delete(contentOfs: ts) |
|
|
|
try tournamentStore.teamScores.delete(contentOfs: ts) |
|
|
|
} catch { |
|
|
|
} catch { |
|
|
|
Logger.error(error) |
|
|
|
Logger.error(error) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
do { |
|
|
|
try tournamentStore.teamRegistrations.addOrUpdate(contentOfs: unsortedTeams()) |
|
|
|
try tournamentStore.matches.addOrUpdate(contentOfs: allMatches) |
|
|
|
} catch { |
|
|
|
} catch { |
|
|
|
Logger.error(error) |
|
|
|
Logger.error(error) |
|
|
|
} |
|
|
|
} |
|
|
|
allRounds().forEach({ round in |
|
|
|
|
|
|
|
round.enableRound() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
try tournamentStore.teamRegistrations.addOrUpdate(contentOfs: teams) |
|
|
|
|
|
|
|
} catch { |
|
|
|
|
|
|
|
Logger.error(error) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
updateTournamentState() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func addNewRound(_ roundIndex: Int) async { |
|
|
|
func addNewRound(_ roundIndex: Int) async { |
|
|
|
|