Broadcast improvements

clubs
Laurent 1 year ago
parent dbbd2d2499
commit 8216a529d0
  1. 4
      tournaments/models/group_stage.py
  2. 12
      tournaments/models/tournament.py

@ -97,8 +97,8 @@ class GroupStage(models.Model):
def starts_soon(self):
if self.start_date:
early_start = self.start_date - timedelta(minute=30)
return datetime.now() > early_start
early_start = self.start_date - timedelta(minutes=30)
return timezone.now() > early_start
else:
return False

@ -400,11 +400,10 @@ class Tournament(models.Model):
matches = []
group_stages = []
if self.group_stages_running():
if len(self.groupstage_set.all()) > 0 and self.no_bracket_match_has_started():
group_stages = self.live_group_stages()
matches = self.broadcasted_group_stages_matches()
else:
# last_started_match = self.first_unfinished_match()
current_round = self.round_to_show()
if current_round:
previous_round = self.round_for_index(current_round.index + 1)
@ -418,6 +417,14 @@ class Tournament(models.Model):
return matches, group_stages
def no_bracket_match_has_started(self):
matches = []
for round in self.round_set.all():
for match in round.match_set.all():
if match.started():
return False
return True
def all_matches(self, hide_empty_matches):
matches = []
for round in self.round_set.all():
@ -437,6 +444,7 @@ class Tournament(models.Model):
def group_stages_running(self):
if len(self.groupstage_set.all()) > 0:
# check le debut des match de Round
matches = self.group_stage_matches()
running_group_stage_matches = [m for m in matches if m.end_date is None]
return len(running_group_stage_matches) > 0

Loading…
Cancel
Save