bracket-feature
laurent 11 months ago
commit 24c45f6001
  1. 8
      tournaments/models/tournament.py

@ -689,12 +689,12 @@ class Tournament(models.Model):
# all started matches have ended, possibly # all started matches have ended, possibly
last_finished_match = self.last_finished_match() last_finished_match = self.last_finished_match()
print(f'last_finished_match = {last_finished_match.name}') print(f'last_finished_match = {last_finished_match.name}')
round_index = last_finished_match.round.index round_root_index = last_finished_match.round.root_round().index
print(f'round_index = {round_index}') print(f'round_index = {round_root_index}')
if round_index == 0: if round_root_index == 0:
return last_finished_match.round return last_finished_match.round
else: else:
round = self.round_set.filter(parent=None,index=round_index-1).first() round = self.round_set.filter(parent=None,index=round_root_index-1).first()
if round: if round:
return round return round
else: else:

Loading…
Cancel
Save