|
|
|
@ -704,25 +704,24 @@ 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() |
|
|
|
|
|
|
|
if last_finished_match: |
|
|
|
round = last_finished_match.round |
|
|
|
round = last_finished_match.round |
|
|
|
if round is None: # when the last finished match is in the group stage |
|
|
|
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() |
|
|
|
round = self.round_set.filter(parent__isnull=True).order_by('-index').first() |
|
|
|
|
|
|
|
|
|
|
|
if round: |
|
|
|
if round: |
|
|
|
# print(f'last_finished_match = {last_finished_match.name}') |
|
|
|
# print(f'last_finished_match = {last_finished_match.name}') |
|
|
|
round_root_index = round.root_round().index |
|
|
|
round_root_index = round.root_round().index |
|
|
|
# print(f'round_index = {round_root_index}') |
|
|
|
# print(f'round_index = {round_root_index}') |
|
|
|
if round_root_index == 0: |
|
|
|
if round_root_index == 0: |
|
|
|
return round |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
round = self.round_set.filter(parent=None,index=round_root_index-1).first() |
|
|
|
|
|
|
|
if round: |
|
|
|
|
|
|
|
return round |
|
|
|
return round |
|
|
|
else: |
|
|
|
else: |
|
|
|
return None |
|
|
|
round = self.round_set.filter(parent=None,index=round_root_index-1).first() |
|
|
|
else: |
|
|
|
if round: |
|
|
|
return None |
|
|
|
return round |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
return None |
|
|
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
def last_started_match(self): |
|
|
|
def last_started_match(self): |
|
|
|
matches = [m for m in self.all_matches(False) if m.start_date] |
|
|
|
matches = [m for m in self.all_matches(False) if m.start_date] |
|
|
|
|