diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index daf6520..d653089 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -1950,6 +1950,11 @@ class Tournament(BaseModel): if event_mode is True and self.event.tournaments.count() == 1: event_mode = False + if self.event.tournaments.count() == 1: + show_teams_in_prog = self.show_teams_in_prog + else: + show_teams_in_prog = self.event.tournaments.filter(show_teams_in_prog=True).first() is not None + # Get all matches from rounds and group stages - use a set to avoid duplicates all_matches = set() @@ -1957,6 +1962,15 @@ class Tournament(BaseModel): if event_mode is True: tournaments = self.event.tournaments.all() + # Check if all tournaments have started - if so, always show teams + all_started = True + for t in tournaments: + if not t.has_started(): + all_started = False + break + if all_started: + show_teams_in_prog = True + for tournament in tournaments: # Get matches only from top-level rounds to avoid duplicates for round in tournament.rounds.filter(parent=None).all(): @@ -2018,7 +2032,7 @@ class Tournament(BaseModel): matches_by_hour[hour_key].append(match) - hide_teams = self.show_teams_in_prog == False + hide_teams = show_teams_in_prog == False # Create match groups for each hour for hour, matches in sorted(matches_by_hour.items()): # Sort matches by court if available @@ -2063,7 +2077,7 @@ class Tournament(BaseModel): matches_by_hour[hour_key].append(match) - hide_teams = self.show_teams_in_prog == False + hide_teams = show_teams_in_prog == False # Create match groups for each hour for hour, matches in sorted(matches_by_hour.items()): # Sort matches by court if available