clubs
Laurent 1 year ago
parent 164be62899
commit 3aee201822
  1. 6
      tournaments/models/tournament.py
  2. 2
      tournaments/views.py

@ -361,7 +361,7 @@ class Tournament(models.Model):
live_matches = [match.live_match() for match in matches] live_matches = [match.live_match() for match in matches]
return MatchGroup(name, live_matches) return MatchGroup(name, live_matches)
def broadcasted_group_stages(self): def live_group_stages(self):
group_stages = list(self.groupstage_set.all()) group_stages = list(self.groupstage_set.all())
group_stages.sort(key=lambda gs: gs.index) group_stages.sort(key=lambda gs: gs.index)
return [gs.live_group_stages() for gs in group_stages] return [gs.live_group_stages() for gs in group_stages]
@ -401,7 +401,7 @@ class Tournament(models.Model):
group_stages = [] group_stages = []
if self.group_stages_running(): if self.group_stages_running():
group_stages = self.broadcasted_group_stages() group_stages = self.live_group_stages()
matches = self.broadcasted_group_stages_matches() matches = self.broadcasted_group_stages_matches()
else: else:
# last_started_match = self.first_unfinished_match() # last_started_match = self.first_unfinished_match()
@ -414,7 +414,7 @@ class Tournament(models.Model):
matches.extend(previous_round.get_matches_recursive(True)) matches.extend(previous_round.get_matches_recursive(True))
else: else:
matches.extend(current_round.all_matches(True)) matches.extend(current_round.all_matches(True))
group_stages = self.broadcasted_group_stages() group_stages = self.live_group_stages()
return matches, group_stages return matches, group_stages

@ -224,7 +224,7 @@ def tournament_broadcasted_group_stages(request, tournament_id):
def tournament_live_group_stage_json(request, tournament_id): def tournament_live_group_stage_json(request, tournament_id):
tournament = get_object_or_404(Tournament, pk=tournament_id) tournament = get_object_or_404(Tournament, pk=tournament_id)
gs_dicts = [gs.to_dict() for gs in tournament.broadcasted_group_stages()] gs_dicts = [gs.to_dict() for gs in tournament.live_group_stages()]
# group_stages = tournament.live_group_stages() # group_stages = tournament.live_group_stages()
data = json.dumps(gs_dicts) data = json.dumps(gs_dicts)
return HttpResponse(data, content_type='application/json') return HttpResponse(data, content_type='application/json')

Loading…
Cancel
Save