remove logs

sync
Laurent 11 months ago
parent 070b134905
commit 02659f631a
  1. 30
      tournaments/models/tournament.py

@ -606,7 +606,7 @@ class Tournament(models.Model):
matches.extend(first_round.get_matches_recursive(True)) matches.extend(first_round.get_matches_recursive(True))
else: else:
current_round = self.round_to_show() current_round = self.round_to_show()
print(f'current_round = {current_round.index} / parent = {current_round.parent}') # print(f'current_round = {current_round.index} / parent = {current_round.parent}')
if current_round: if current_round:
all_upper_matches_are_over = current_round.all_matches_are_over() all_upper_matches_are_over = current_round.all_matches_are_over()
if all_upper_matches_are_over is False: if all_upper_matches_are_over is False:
@ -615,20 +615,20 @@ class Tournament(models.Model):
# Add full matches from the next rounds # Add full matches from the next rounds
next_round = self.round_for_index(current_round.index - 1) next_round = self.round_for_index(current_round.index - 1)
if next_round: if next_round:
print('next round') # print('next round')
matches.extend(next_round.get_matches_recursive(True)) matches.extend(next_round.get_matches_recursive(True))
if all_upper_matches_are_over is True: if all_upper_matches_are_over is True:
print('all_upper_matches_are_over') # print('all_upper_matches_are_over')
matches.extend(current_round.get_matches_recursive(True)) matches.extend(current_round.get_matches_recursive(True))
# Add matches from the previous round or group_stages # Add matches from the previous round or group_stages
previous_round = self.round_for_index(current_round.index + 1) previous_round = self.round_for_index(current_round.index + 1)
if previous_round: if previous_round:
print('previous_round') # print('previous_round')
matches.extend(previous_round.get_matches_recursive(True)) matches.extend(previous_round.get_matches_recursive(True))
else: else:
print('group_stages') # print('group_stages')
group_stages = [gs.live_group_stages() for gs in self.last_group_stage_step()] group_stages = [gs.live_group_stages() for gs in self.last_group_stage_step()]
return matches, group_stages return matches, group_stages
@ -669,7 +669,7 @@ class Tournament(models.Model):
def first_unfinished_match(self): def first_unfinished_match(self):
matches = [m for m in self.all_matches(False) if m.start_date and m.end_date is None] matches = [m for m in self.all_matches(False) if m.start_date and m.end_date is None]
print(f'first_unfinished_match > match len: {len(matches)}') # print(f'first_unfinished_match > match len: {len(matches)}')
matches.sort(key=lambda m: m.start_date) matches.sort(key=lambda m: m.start_date)
if matches: if matches:
return matches[0] return matches[0]
@ -677,20 +677,20 @@ class Tournament(models.Model):
return None return None
def round_to_show(self): def round_to_show(self):
print('===== round_to_show') # print('===== round_to_show')
last_started_match = self.first_unfinished_match() last_started_match = self.first_unfinished_match()
if last_started_match: if last_started_match:
print(f'last_started_match = {last_started_match.name}') # print(f'last_started_match = {last_started_match.name}')
current_round = last_started_match.round.root_round() current_round = last_started_match.round.root_round()
print(f'round_to_show > current_round: {current_round.name()}') # print(f'round_to_show > current_round: {current_round.name()}')
if current_round: if current_round:
return current_round return current_round
# 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_root_index = last_finished_match.round.root_round().index round_root_index = last_finished_match.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 last_finished_match.round return last_finished_match.round
else: else:
@ -700,14 +700,6 @@ class Tournament(models.Model):
else: else:
return None return None
# 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
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]
matches.sort(key=lambda m: m.start_date, reverse=True) matches.sort(key=lambda m: m.start_date, reverse=True)

Loading…
Cancel
Save