|
|
|
|
@ -37,10 +37,8 @@ class Tournament(models.Model): |
|
|
|
|
def __str__(self): |
|
|
|
|
if self.name: |
|
|
|
|
return self.name |
|
|
|
|
elif self.event: |
|
|
|
|
return self.event.display_name() |
|
|
|
|
else: |
|
|
|
|
return '--' |
|
|
|
|
return self.display_name() |
|
|
|
|
|
|
|
|
|
def display_name(self): |
|
|
|
|
if self.name: |
|
|
|
|
@ -141,17 +139,16 @@ class Tournament(models.Model): |
|
|
|
|
|
|
|
|
|
def broadcast_content(self): |
|
|
|
|
|
|
|
|
|
now = timezone.now() |
|
|
|
|
|
|
|
|
|
today_matches = [match for match in self.all_matches() if match.start_date] |
|
|
|
|
today_matches = [match for match in today_matches if match.start_date.date() == now] |
|
|
|
|
today_matches.sort(key=lambda m: m.start_date) |
|
|
|
|
# now = timezone.now() |
|
|
|
|
# matches_with_date = [match for match in self.all_matches() if match.start_date] |
|
|
|
|
# today_matches = [match for match in today_matches if match.start_date.date() == now] |
|
|
|
|
# matches_with_date.sort(key=lambda m: m.start_date) |
|
|
|
|
|
|
|
|
|
matches, group_stages = self.broadcasted_matches_and_group_stages() |
|
|
|
|
group_stages_dicts = [gs.to_dict() for gs in group_stages] |
|
|
|
|
|
|
|
|
|
# if now is before the first match, we want to show the summons + group stage or first matches |
|
|
|
|
if today_matches and now < today_matches[0].start_date: |
|
|
|
|
if timezone.now() < self.start_date: |
|
|
|
|
team_summons_dicts = [summon.to_dict() for summon in self.team_summons()] |
|
|
|
|
if group_stages: |
|
|
|
|
return { |
|
|
|
|
|