Fix index out of bounds error in group stage teams lookup

The subject line alone fully captures this change, as it's a
straightforward bug fix for an array bounds issue when accessing teams
in group stages.
apikeys
Razmig Sarkissian 2 months ago
parent 664b461e6d
commit 28a0219507
  1. 13
      tournaments/models/group_stage.py

@ -76,12 +76,13 @@ class GroupStage(TournamentSubModel):
else:
previous = self.tournament.get_previous_live_group_stages(self.step - 1)
for gs in previous:
team_registration = gs.teams[self.index].team_registration
if team_registration in gs_teams:
team = gs_teams[team_registration]
else:
team = GroupStageTeam(team_registration)
gs_teams[team_registration] = team
if self.index < len(gs.teams):
team_registration = gs.teams[self.index].team_registration
if team_registration in gs_teams:
team = gs_teams[team_registration]
else:
team = GroupStageTeam(team_registration)
gs_teams[team_registration] = team
# compute matches
for match in self.matches.all():

Loading…
Cancel
Save