bracket-feature
Laurent 11 months ago
parent 45e97d28c8
commit 4fbbda02e2
  1. 4
      tournaments/models/tournament.py

@ -606,7 +606,7 @@ class Tournament(models.Model):
matches.extend(first_round.get_matches_recursive(True))
else:
current_round = self.round_to_show()
print(f'current_round = {current_round.index}')
print(f'current_round = {current_round.index} / parent = {current_round.parent}')
if current_round:
all_upper_matches_are_over = current_round.all_matches_are_over()
if all_upper_matches_are_over is False:
@ -679,11 +679,13 @@ class Tournament(models.Model):
last_started_match = self.first_unfinished_match()
if last_started_match:
current_round = last_started_match.round.root_round()
print(f'round_to_show > current_round: {current_round.name()}')
if current_round:
return current_round
main_rounds = list(self.round_set.filter(parent=None).all())
main_rounds.sort(key=lambda r: r.index)
if main_rounds:
print(f'round_to_show > main_rounds: {main_rounds[0].name()}')
return main_rounds[0]
else:
return None

Loading…
Cancel
Save