diff --git a/tournaments/models/group_stage.py b/tournaments/models/group_stage.py index 0a93c56..399922e 100644 --- a/tournaments/models/group_stage.py +++ b/tournaments/models/group_stage.py @@ -70,10 +70,11 @@ class GroupStage(models.Model): total1 = scores1[0] total2 = scores2[0] - team1 = gs_teams[ts1.team_registration] - team2 = gs_teams[ts2.team_registration] - team1.diff = total1 - total2 - team2.diff = total2 - total1 + if ts1.team_registration in gs_teams and ts2.team_registration in gs_teams: + team1 = gs_teams[ts1.team_registration] + team2 = gs_teams[ts2.team_registration] + team1.diff = total1 - total2 + team2.diff = total2 - total1 teams = sorted(gs_teams.values(), key=lambda t: t.position) for team in teams: @@ -116,7 +117,10 @@ class LiveGroupStage: class GroupStageTeam: def __init__(self, team_registration): self.names = team_registration.team_names() - self.position = team_registration.group_stage_position + if team_registration.group_stage_position: + self.position = team_registration.group_stage_position + else: + self.position = 0 self.wins = 0 self.losses = 0 self.diff = 0 diff --git a/tournaments/templates/tournaments/group_stage_cell.html b/tournaments/templates/tournaments/group_stage_cell.html index 9d596bf..5ee63fc 100644 --- a/tournaments/templates/tournaments/group_stage_cell.html +++ b/tournaments/templates/tournaments/group_stage_cell.html @@ -15,7 +15,7 @@
{% for name in team.names %} -
+
{{ name }}
{% endfor %}