mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Refactor playoff match generation logic to only generate the minimum number of matches needed in each iteration.
This commit is contained in:
@@ -92,7 +92,7 @@ func TestAllianceSelection(t *testing.T) {
|
||||
}
|
||||
matches, err := web.arena.Database.GetMatchesByType("elimination")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 6, len(matches))
|
||||
assert.Equal(t, 2, len(matches))
|
||||
}
|
||||
|
||||
func TestAllianceSelectionErrors(t *testing.T) {
|
||||
|
||||
@@ -436,12 +436,14 @@ 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 {
|
||||
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 {
|
||||
if err = tournament.UpdateAlliance(
|
||||
web.arena.Database, [3]int{match.Blue1, match.Blue2, match.Blue3}, match.ElimBlueAlliance,
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user