From 8de5758650730b2a2a076c15930c941286ecfe5a Mon Sep 17 00:00:00 2001 From: Raz Date: Tue, 25 Feb 2025 12:41:46 +0100 Subject: [PATCH] wip --- tournaments/models/match.py | 28 ++- tournaments/models/round.py | 4 +- tournaments/static/tournaments/css/style.css | 14 ++ .../broadcast/broadcasted_match.html | 2 + .../templates/tournaments/match_cell.html | 2 + .../tournaments/navigation_tournament.html | 1 + .../tournaments/tournament_bracket.html | 181 ++++++++++++++++++ tournaments/urls.py | 1 + tournaments/views.py | 33 ++++ 9 files changed, 257 insertions(+), 9 deletions(-) create mode 100644 tournaments/templates/tournaments/tournament_bracket.html diff --git a/tournaments/models/match.py b/tournaments/models/match.py index 17d29a8..8265ba7 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -161,13 +161,21 @@ class Match(models.Model): # No team scores at all if previous_top_match: - names = [f"Gagnants {previous_top_match.computed_name()}", ''] + names = [f"Gagnant {previous_top_match.computed_name()}", ''] team = self.default_live_team(names) teams.append(team) if previous_bottom_match: - names = [f"Gagnants {previous_bottom_match.computed_name()}", ''] + names = [f"Gagnant {previous_bottom_match.computed_name()}", ''] team = self.default_live_team(names) teams.append(team) + + if len(teams) == 0: + names = ['', ''] + team = self.default_live_team(names) + teams.append(team) + teams.append(team) + return teams + elif len(team_scores) == 1: # Only one team score, handle missing one existing_team = team_scores[0].live_team(self) @@ -177,17 +185,21 @@ class Match(models.Model): teams.append(existing_team) else: if previous_top_match and previous_top_match.disabled == False and previous_top_match.end_date is None: - names = [f"Gagnants {previous_top_match.computed_name()}", ''] + names = [f"Gagnant {previous_top_match.computed_name()}", ''] team = self.default_live_team(names) teams.append(team) teams.append(existing_team) elif previous_bottom_match: - names = [f"Gagnants {previous_bottom_match.computed_name()}", ''] + names = [f"Gagnant {previous_bottom_match.computed_name()}", ''] team = self.default_live_team(names) teams.append(existing_team) teams.append(team) else: teams.append(existing_team) + names = ["Qualifié Entrant", ''] + team = self.default_live_team(names) + teams.append(team) + else: # Both team scores present teams.extend([team_score.live_team(self) for team_score in team_scores]) @@ -323,7 +335,7 @@ class Match(models.Model): ended = self.end_date is not None live_format = "Format " + FederalMatchCategory(self.format).format_label_short - livematch = LiveMatch(title, date, time_indication, court, self.started(), ended, group_stage_name, live_format) + livematch = LiveMatch(title, date, time_indication, court, self.started(), ended, group_stage_name, live_format, self.disabled) for team in self.live_teams(): livematch.add_team(team) @@ -374,7 +386,7 @@ class Team: } class LiveMatch: - def __init__(self, title, date, time_indication, court, started, ended, group_stage_name, format): + def __init__(self, title, date, time_indication, court, started, ended, group_stage_name, format, disabled): self.title = title self.date = date self.teams = [] @@ -385,6 +397,7 @@ class LiveMatch: self.has_walk_out = False self.group_stage_name = group_stage_name self.format = format + self.disabled = disabled def add_team(self, team): self.teams.append(team) @@ -402,7 +415,8 @@ class LiveMatch: "ended": self.ended, "has_walk_out": self.has_walk_out, "group_stage_name": self.group_stage_name, - "format": self.format + "format": self.format, + "disabled": self.disabled } def show_time_indication(self): diff --git a/tournaments/models/round.py b/tournaments/models/round.py index befe57a..ea89370 100644 --- a/tournaments/models/round.py +++ b/tournaments/models/round.py @@ -31,9 +31,9 @@ class Round(models.Model): if self.index == 0: return "Finale" elif self.index == 1: - return "Demi-Finales" + return "Demi" elif self.index == 2: - return "Quarts de finale" + return "Quart" else: squared = 2 ** self.index return f"{squared}ème" diff --git a/tournaments/static/tournaments/css/style.css b/tournaments/static/tournaments/css/style.css index a112a8b..1c6c8c4 100644 --- a/tournaments/static/tournaments/css/style.css +++ b/tournaments/static/tournaments/css/style.css @@ -826,3 +826,17 @@ h-margin { .tournament-info a:hover { color: #f39200; } + +.status-container { + margin: 0 -20px -20px -20px; /* Negative margin to counter the bubble padding, including bottom */ + padding: 0 20px 20px 20px; /* Add padding back to maintain text alignment, including bottom */ + border-radius: 0 0 24px 24px; /* Match the bubble's bottom corners */ +} + +.status-container.running { + background-color: #90ee90; /* Light green color */ +} + +.bubble { + position: relative; /* Add this */ +} diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_match.html b/tournaments/templates/tournaments/broadcast/broadcasted_match.html index 9e3d0cc..cbda3f7 100644 --- a/tournaments/templates/tournaments/broadcast/broadcasted_match.html +++ b/tournaments/templates/tournaments/broadcast/broadcasted_match.html @@ -61,9 +61,11 @@ +
+
diff --git a/tournaments/templates/tournaments/match_cell.html b/tournaments/templates/tournaments/match_cell.html index fc0e17c..7be32ef 100644 --- a/tournaments/templates/tournaments/match_cell.html +++ b/tournaments/templates/tournaments/match_cell.html @@ -56,6 +56,7 @@ +
+
diff --git a/tournaments/templates/tournaments/navigation_tournament.html b/tournaments/templates/tournaments/navigation_tournament.html index b102ceb..0ecd874 100644 --- a/tournaments/templates/tournaments/navigation_tournament.html +++ b/tournaments/templates/tournaments/navigation_tournament.html @@ -1,6 +1,7 @@