|
|
|
@ -190,15 +190,21 @@ struct MatchSetupView: View { |
|
|
|
|
|
|
|
|
|
|
|
func _removeTeam(team: TeamRegistration, teamPosition: TeamPosition) -> some View { |
|
|
|
func _removeTeam(team: TeamRegistration, teamPosition: TeamPosition) -> some View { |
|
|
|
Button(role: .cancel) { |
|
|
|
Button(role: .cancel) { |
|
|
|
//todo |
|
|
|
|
|
|
|
if match.isSeededBy(team: team, inTeamPosition: teamPosition) { |
|
|
|
if match.isSeededBy(team: team, inTeamPosition: teamPosition) { |
|
|
|
|
|
|
|
if let score = match.teamScore(ofTeam: team) { |
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
try tournamentStore.teamScores.delete(instance: score) |
|
|
|
|
|
|
|
} catch { |
|
|
|
|
|
|
|
Logger.error(error) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
team.bracketPosition = nil |
|
|
|
team.bracketPosition = nil |
|
|
|
do { |
|
|
|
do { |
|
|
|
try tournamentStore.teamRegistrations.addOrUpdate(instance: team) |
|
|
|
try tournamentStore.teamRegistrations.addOrUpdate(instance: team) |
|
|
|
} catch { |
|
|
|
} catch { |
|
|
|
Logger.error(error) |
|
|
|
Logger.error(error) |
|
|
|
} |
|
|
|
} |
|
|
|
//match.updateTeamScores() |
|
|
|
|
|
|
|
match.previousMatches().forEach { previousMatch in |
|
|
|
match.previousMatches().forEach { previousMatch in |
|
|
|
if previousMatch.disabled { |
|
|
|
if previousMatch.disabled { |
|
|
|
previousMatch.enableMatch() |
|
|
|
previousMatch.enableMatch() |
|
|
|
|