|
|
|
|
@ -160,7 +160,6 @@ struct TournamentRankView: View { |
|
|
|
|
struct TeamRankCellView: View { |
|
|
|
|
@Environment(\.editMode) private var editMode |
|
|
|
|
@Environment(Tournament.self) var tournament: Tournament |
|
|
|
|
@EnvironmentObject var dataStore: DataStore |
|
|
|
|
@State private var isEditingTeam: Bool = false |
|
|
|
|
@Bindable var team: TeamRegistration |
|
|
|
|
@State var key: Int |
|
|
|
|
@ -173,7 +172,7 @@ struct TournamentRankView: View { |
|
|
|
|
key -= 1 |
|
|
|
|
team.finalRanking = key |
|
|
|
|
do { |
|
|
|
|
try dataStore.teamRegistrations.addOrUpdate(instance: team) |
|
|
|
|
try self.tournament.tournamentStore.teamRegistrations.addOrUpdate(instance: team) |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
@ -264,7 +263,7 @@ struct TournamentRankView: View { |
|
|
|
|
key += 1 |
|
|
|
|
team.finalRanking = key |
|
|
|
|
do { |
|
|
|
|
try dataStore.teamRegistrations.addOrUpdate(instance: team) |
|
|
|
|
try self.tournament.tournamentStore.teamRegistrations.addOrUpdate(instance: team) |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
@ -283,7 +282,7 @@ struct TournamentRankView: View { |
|
|
|
|
Button("Valider") { |
|
|
|
|
team.pointsEarned = tournament.isAnimation() ? nil : tournament.tournamentLevel.points(for: key - 1, count: tournament.teamCount) |
|
|
|
|
do { |
|
|
|
|
try dataStore.teamRegistrations.addOrUpdate(instance: team) |
|
|
|
|
try self.tournament.tournamentStore.teamRegistrations.addOrUpdate(instance: team) |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
|