bracket-feature
Laurent 9 months ago
parent 11ca00cebf
commit af3026bd9b
  1. 11
      tournaments/models/tournament.py

@ -733,12 +733,17 @@ class Tournament(models.Model):
# all started matches have ended, possibly
last_finished_match = self.last_finished_match()
if last_finished_match and last_finished_match.round:
round = last_finished_match.round
if round is None: # when the last finished match is in the group stage
round = self.round_set.filter(parent__isnull=True).order_by('-index').first()
if round:
# print(f'last_finished_match = {last_finished_match.name}')
round_root_index = last_finished_match.round.root_round().index
round_root_index = round.root_round().index
# print(f'round_index = {round_root_index}')
if round_root_index == 0:
return last_finished_match.round
return round
else:
round = self.round_set.filter(parent=None,index=round_root_index-1).first()
if round:

Loading…
Cancel
Save