From 1c0e4e0472bdca94ea5e5aaf98a0a87dc191d963 Mon Sep 17 00:00:00 2001 From: Raz Date: Thu, 10 Apr 2025 17:26:27 +0200 Subject: [PATCH] affinage bracket broadcast and remove LL in loser matchs --- tournaments/models/match.py | 14 +++++++++++--- .../static/tournaments/css/tournament_bracket.css | 9 +++++++++ .../templates/tournaments/bracket_match_cell.html | 2 +- .../tournaments/broadcast/broadcasted_bracket.html | 6 ++---- .../tournaments/broadcast/broadcasted_match.html | 2 +- tournaments/templates/tournaments/match_cell.html | 2 +- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/tournaments/models/match.py b/tournaments/models/match.py index 302bf17..9ea2556 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -434,7 +434,7 @@ class Match(SideStoreModel): ended = self.end_date is not None live_format = "Format " + FederalMatchCategory(self.format).format_label_short - livematch = LiveMatch(self.index, title, date, time_indication, court, self.started(), ended, group_stage_name, live_format, self.start_date, self.court_index, self.disabled, bracket_name) + livematch = LiveMatch(self.index, title, date, time_indication, court, self.started(), ended, group_stage_name, live_format, self.start_date, self.court_index, self.disabled, bracket_name, self.should_show_lucky_loser_status()) for team in self.live_teams(): livematch.add_team(team) @@ -447,6 +447,12 @@ class Match(SideStoreModel): else: return self.team_scores.order_by('team_registration__bracket_position') + def should_show_lucky_loser_status(self): + if self.group_stage is not None: + return False + if self.round and self.round.parent is None and self.round.group_stage_loser_bracket is False: + return True + return False # def non_null_start_date(self): # if self.start_date: # return self.start_date @@ -495,7 +501,7 @@ class Team: } class LiveMatch: - def __init__(self, index, title, date, time_indication, court, started, ended, group_stage_name, format, start_date, court_index, disabled, bracket_name): + def __init__(self, index, title, date, time_indication, court, started, ended, group_stage_name, format, start_date, court_index, disabled, bracket_name, should_show_lucky_loser_status): self.index = index self.title = title self.date = date @@ -511,6 +517,7 @@ class LiveMatch: self.start_date = start_date self.court_index = court_index self.bracket_name = bracket_name + self.should_show_lucky_loser_status = should_show_lucky_loser_status def add_team(self, team): self.teams.append(team) @@ -532,7 +539,8 @@ class LiveMatch: "format": self.format, "disabled": self.disabled, "court_index": self.court_index, - "bracket_name": self.bracket_name + "bracket_name": self.bracket_name, + "should_show_lucky_loser_status": self.should_show_lucky_loser_status, } def show_time_indication(self): diff --git a/tournaments/static/tournaments/css/tournament_bracket.css b/tournaments/static/tournaments/css/tournament_bracket.css index 5593b51..02d0648 100644 --- a/tournaments/static/tournaments/css/tournament_bracket.css +++ b/tournaments/static/tournaments/css/tournament_bracket.css @@ -54,9 +54,18 @@ } .round-title.broadcast-mode { + font-size: 0.9em; width: auto; /* Change from 100% to auto */ } +.match-result.broadcast-mode { + padding: 4px; +} + +.score.broadcast-mode { + font-size: 1em; +} + .round-name { color: #505050; font-size: 1.5em; diff --git a/tournaments/templates/tournaments/bracket_match_cell.html b/tournaments/templates/tournaments/bracket_match_cell.html index 5b8051b..32c8da2 100644 --- a/tournaments/templates/tournaments/bracket_match_cell.html +++ b/tournaments/templates/tournaments/bracket_match_cell.html @@ -23,7 +23,7 @@ {% if team.is_lucky_loser or team.walk_out == 1 %}
- {% if team.is_lucky_loser %}(LL){% elif team.walk_out == 1 %}(WO){% endif %} + {% if match.should_show_lucky_loser_status and team.is_lucky_loser %}(LL){% elif team.walk_out == 1 %}(WO){% endif %}
{% endif %} diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_bracket.html b/tournaments/templates/tournaments/broadcast/broadcasted_bracket.html index 4c6e842..45e93d8 100644 --- a/tournaments/templates/tournaments/broadcast/broadcasted_bracket.html +++ b/tournaments/templates/tournaments/broadcast/broadcasted_bracket.html @@ -67,10 +67,8 @@ // Generate HTML for each team match.teams.forEach((team, teamIndex) => { html += ` -
+
- ${team.is_lucky_loser ? '
(LL)
' : ''} - ${team.walk_out === 1 ? '
(WO)
' : ''} ${team.names.map(name => `
@@ -95,7 +93,7 @@ ` : ''} ${team.weight && !match.has_walk_out && (!team.scores || team.scores.length === 0) ? ` - ${team.weight} + ${team.weight} ` : ''}
`; diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_match.html b/tournaments/templates/tournaments/broadcast/broadcasted_match.html index 71b8144..57e37ca 100644 --- a/tournaments/templates/tournaments/broadcast/broadcasted_match.html +++ b/tournaments/templates/tournaments/broadcast/broadcasted_match.html @@ -21,7 +21,7 @@ 'two-players': match.teams[i-1].names.length === 2 }"> -