mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Fix bug with committing playoff matches after a team substitution.
This commit is contained in:
@@ -376,6 +376,15 @@ func (web *Web) commitMatchScore(match *model.Match, matchResult *model.MatchRes
|
||||
}
|
||||
|
||||
if match.ShouldUpdateEliminationMatches() {
|
||||
if err = tournament.UpdateAlliance(web.arena.Database, [3]int{match.Red1, match.Red2, match.Red3},
|
||||
match.ElimRedAlliance); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = tournament.UpdateAlliance(web.arena.Database, [3]int{match.Blue1, match.Blue2, match.Blue3},
|
||||
match.ElimBlueAlliance); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Generate any subsequent elimination matches.
|
||||
isTournamentWon, err := tournament.UpdateEliminationSchedule(web.arena.Database,
|
||||
time.Now().Add(time.Second*tournament.ElimMatchSpacingSec))
|
||||
|
||||
@@ -228,6 +228,8 @@ func TestCommitCards(t *testing.T) {
|
||||
// Check that a red card in eliminations zeroes out the score.
|
||||
tournament.CreateTestAlliances(web.arena.Database, 2)
|
||||
match.Type = "elimination"
|
||||
match.ElimRedAlliance = 1
|
||||
match.ElimBlueAlliance = 2
|
||||
web.arena.Database.SaveMatch(match)
|
||||
matchResult = model.BuildTestMatchResult(match.Id, 10)
|
||||
matchResult.MatchType = match.Type
|
||||
|
||||
@@ -39,7 +39,7 @@ func TestMatchReviewEditExistingResult(t *testing.T) {
|
||||
web := setupTestWeb(t)
|
||||
|
||||
match := model.Match{Type: "elimination", DisplayName: "QF4-3", Status: "complete", Winner: "R", Red1: 1001,
|
||||
Red2: 1002, Red3: 1003, Blue1: 1004, Blue2: 1005, Blue3: 1006}
|
||||
Red2: 1002, Red3: 1003, Blue1: 1004, Blue2: 1005, Blue3: 1006, ElimRedAlliance: 1, ElimBlueAlliance: 2}
|
||||
web.arena.Database.CreateMatch(&match)
|
||||
matchResult := model.BuildTestMatchResult(match.Id, 1)
|
||||
matchResult.MatchType = match.Type
|
||||
@@ -79,7 +79,7 @@ func TestMatchReviewCreateNewResult(t *testing.T) {
|
||||
web := setupTestWeb(t)
|
||||
|
||||
match := model.Match{Type: "elimination", DisplayName: "QF4-3", Status: "complete", Winner: "R", Red1: 1001,
|
||||
Red2: 1002, Red3: 1003, Blue1: 1004, Blue2: 1005, Blue3: 1006}
|
||||
Red2: 1002, Red3: 1003, Blue1: 1004, Blue2: 1005, Blue3: 1006, ElimRedAlliance: 1, ElimBlueAlliance: 2}
|
||||
web.arena.Database.CreateMatch(&match)
|
||||
tournament.CreateTestAlliances(web.arena.Database, 2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user