From d297a4c78a13c18902e46c7e9f839d8dddb0b29e Mon Sep 17 00:00:00 2001 From: Raz Date: Wed, 12 Feb 2025 21:00:35 +0100 Subject: [PATCH 01/25] fix tournament info url detection and add format in match cells improve rankings broadcast screen --- tournaments/models/enums.py | 20 +++++++++++++++++++ tournaments/models/match.py | 8 ++++++-- tournaments/static/tournaments/css/style.css | 10 ++++++++++ .../broadcast/broadcasted_match.html | 10 +++++++--- .../broadcast/broadcasted_ranking.html | 10 ++++++++-- .../templates/tournaments/match_cell.html | 10 ++++++---- .../tournaments/tournament_info.html | 3 ++- 7 files changed, 59 insertions(+), 12 deletions(-) diff --git a/tournaments/models/enums.py b/tournaments/models/enums.py index 666aca2..c3f3be6 100644 --- a/tournaments/models/enums.py +++ b/tournaments/models/enums.py @@ -96,6 +96,26 @@ class FederalMatchCategory(models.IntegerChoices): SINGLE_SET_OF_FOUR_GAMES = 13, 'Single set of four games' SINGLE_SET_OF_FOUR_GAMES_DECISIVE_POINT = 14, 'Single set of four games with decisive point' + @property + def format_label_short(self): + format_mapping = { + self.TWO_SETS: "A1", + self.TWO_SETS_SUPER_TIE: "B1", + self.TWO_SETS_FOUR_GAME: "C1", + self.NINE_GAMES: "D1", + self.SUPER_TIE: "E", + self.TWO_SETS_OF_SUPER_TIE: "G", + self.MEGA_TIE: "F", + self.SINGLE_SET: "H1", + self.SINGLE_SET_DECISIVE_POINT: "H2", + self.TWO_SETS_DECISIVE_POINT: "A2", + self.TWO_SETS_DECISIVE_POINT_SUPER_TIE: "B2", + self.TWO_SETS_FOUR_GAME_DECISIVE_POINT: "C2", + self.NINE_GAMES_DECISIVE_POINT: "D2", + self.SINGLE_SET_OF_FOUR_GAMES: "I1" + } + return format_mapping.get(self, "") + def last_set_is_tie_break(value): if value == FederalMatchCategory.TWO_SETS_FOUR_GAME or value == FederalMatchCategory.TWO_SETS_FOUR_GAME_DECISIVE_POINT or value == FederalMatchCategory.TWO_SETS_SUPER_TIE or value == FederalMatchCategory.SUPER_TIE or value == FederalMatchCategory.MEGA_TIE or value == FederalMatchCategory.TWO_SETS_DECISIVE_POINT_SUPER_TIE: return True diff --git a/tournaments/models/match.py b/tournaments/models/match.py index acdf519..b991533 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -318,7 +318,9 @@ class Match(models.Model): group_stage_name = self.group_stage.display_name() ended = self.end_date is not None - livematch = LiveMatch(title, date, time_indication, court, self.started(), ended, group_stage_name) + live_format = "Format " + FederalMatchCategory(self.format).format_label_short + + livematch = LiveMatch(title, date, time_indication, court, self.started(), ended, group_stage_name, live_format) for team in self.live_teams(): livematch.add_team(team) @@ -369,7 +371,7 @@ class Team: } class LiveMatch: - def __init__(self, title, date, time_indication, court, started, ended, group_stage_name): + def __init__(self, title, date, time_indication, court, started, ended, group_stage_name, format): self.title = title self.date = date self.teams = [] @@ -379,6 +381,7 @@ class LiveMatch: self.ended = ended self.has_walk_out = False self.group_stage_name = group_stage_name + self.format = format def add_team(self, team): self.teams.append(team) @@ -396,6 +399,7 @@ class LiveMatch: "ended": self.ended, "has_walk_out": self.has_walk_out, "group_stage_name": self.group_stage_name, + "format": self.format } def show_time_indication(self): diff --git a/tournaments/static/tournaments/css/style.css b/tournaments/static/tournaments/css/style.css index bbb3d49..6b28ce4 100644 --- a/tournaments/static/tournaments/css/style.css +++ b/tournaments/static/tournaments/css/style.css @@ -246,6 +246,7 @@ tr { font-family: "Anybody-ExtraBold"; font-size: 1.2em; color: #1b223a; + line-height: 24px; /* Match the height of flex-row */ } .title { @@ -816,3 +817,12 @@ h-margin { .group-stage-link:hover { color: #f39200; /* Or whatever hover color you prefer */ } + +.tournament-info a { + color: #f39200; + text-decoration: underline; + font-weight: bold; +} +.tournament-info a:hover { + color: #f39200; +} diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_match.html b/tournaments/templates/tournaments/broadcast/broadcasted_match.html index ef51dd8..9e3d0cc 100644 --- a/tournaments/templates/tournaments/broadcast/broadcasted_match.html +++ b/tournaments/templates/tournaments/broadcast/broadcasted_match.html @@ -2,9 +2,13 @@
- +