From 5e77ab9533bdb3536f38131ef5a91089909f210e Mon Sep 17 00:00:00 2001 From: Laurent Date: Sun, 28 Apr 2024 13:09:40 +0200 Subject: [PATCH 1/2] Fix team showing its weight whereas it has walked out --- tournaments/models/group_stage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tournaments/models/group_stage.py b/tournaments/models/group_stage.py index e8b1430..7c2bd73 100644 --- a/tournaments/models/group_stage.py +++ b/tournaments/models/group_stage.py @@ -49,7 +49,7 @@ class GroupStage(models.Model): scores1 = ts1.scores() scores2 = ts2.scores() - if len(scores1) == len(scores2) and len(scores1) > 0: + if match.winning_team_id: for team_score in match.team_scores.all(): team_registration = team_score.team_registration From d81f02b78303cc9426994f427040776d1f194948 Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 29 Apr 2024 09:45:00 +0200 Subject: [PATCH 2/2] Fixes layout and stuff --- tournaments/admin.py | 2 +- tournaments/models/match.py | 14 ++- tournaments/models/round.py | 4 +- tournaments/models/tournament.py | 2 +- tournaments/static/tournaments/css/style.css | 93 +++++++++++++++---- .../tournaments/broadcasted_group_stages.html | 56 ----------- .../tournaments/broadcasted_match.html | 27 ++++++ .../tournaments/broadcasted_matches.html | 28 ++++-- .../templates/tournaments/match_cell.html | 17 ++-- tournaments/views.py | 2 +- 10 files changed, 143 insertions(+), 102 deletions(-) diff --git a/tournaments/admin.py b/tournaments/admin.py index a3c9ccf..216fc4f 100644 --- a/tournaments/admin.py +++ b/tournaments/admin.py @@ -30,7 +30,7 @@ class TournamentAdmin(admin.ModelAdmin): list_display = ['display_name', 'event', 'is_private', 'start_date'] class TeamScoreAdmin(admin.ModelAdmin): - list_display = ['team_registration', 'match', 'score'] + list_display = ['team_registration', 'match', 'score', 'walk_out'] class RoundAdmin(admin.ModelAdmin): list_display = ['tournament', 'name', 'index', 'parent'] diff --git a/tournaments/models/match.py b/tournaments/models/match.py index 7697552..16755fc 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -178,9 +178,12 @@ class LiveMatch: self.court = court self.started = started self.ended = ended + self.has_walk_out = False def add_team(self, team): self.teams.append(team) + if team.walk_out: + self.has_walk_out = True def to_dict(self): return { @@ -191,13 +194,14 @@ class LiveMatch: "court": self.court, "started": self.started, "ended": self.ended, + "has_walk_out": self.has_walk_out, } - def has_walk_out(self): - for team in self.teams: - if team.walk_out: - return True - return False + # def has_walk_out(self): + # for team in self.teams: + # if team.walk_out: + # return True + # return False def show_duration(self): for team in self.teams: diff --git a/tournaments/models/round.py b/tournaments/models/round.py index 640f4df..fc589df 100644 --- a/tournaments/models/round.py +++ b/tournaments/models/round.py @@ -42,10 +42,10 @@ class Round(models.Model): matches.extend(child.ranking_matches(hide_empty_matches)) return matches - def all_matches(self): + def all_matches(self, hide_empty_matches): matches = [] matches.extend(self.match_set.all()) - matches.extend(self.get_matches_recursive(False)) + matches.extend(self.get_matches_recursive(hide_empty_matches)) return matches def get_matches_recursive(self, hide_empty_matches): diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index cb2d180..392a47b 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -192,7 +192,7 @@ class Tournament(models.Model): def all_matches(self, hide_empty_matches): matches = [] for round in self.round_set.all(): - matches.extend(round.all_matches()) + matches.extend(round.all_matches(hide_empty_matches)) for group_stage in self.groupstage_set.all(): matches.extend(group_stage.match_set.all()) diff --git a/tournaments/static/tournaments/css/style.css b/tournaments/static/tournaments/css/style.css index e5922bf..ca0a1b4 100644 --- a/tournaments/static/tournaments/css/style.css +++ b/tournaments/static/tournaments/css/style.css @@ -51,18 +51,23 @@ header { a { color: #707070; } + a:hover { color: #f39200; } nav { - display: flex; /* Use flexbox */ - flex-wrap: wrap; /* Allow items to wrap onto multiple lines */ - justify-content: flex-start; /* Align items to the start */ + display: flex; + /* Use flexbox */ + flex-wrap: wrap; + /* Allow items to wrap onto multiple lines */ + justify-content: flex-start; + /* Align items to the start */ } nav a { - margin-right: 6px; /* Adjust the horizontal spacing between elements */ + margin-right: 6px; + /* Adjust the horizontal spacing between elements */ } /* a { @@ -83,7 +88,9 @@ nav a { .wrapper { margin: 0px 10px; } -@media print, screen and (min-width: 40em) { + +@media print, +screen and (min-width: 40em) { .wrapper { margin: 0px 40px; } @@ -159,6 +166,7 @@ tr { font-size: 1.2em; /* color: #707070; */ } + .semibold { font-weight: 600; } @@ -191,9 +199,11 @@ tr { .padding-bottom-small { padding-bottom: 4px; } + .padding-bottom { padding-bottom: 20px; } + .padding-top-small { padding-top: 4px; } @@ -201,6 +211,7 @@ tr { .names { /* width: 70%; */ } + .team-names-box { height: 60px; } @@ -214,29 +225,32 @@ tr { .player { flex: 1; display: flex; - flex-direction: column; /* Stack player names vertically */ + flex-direction: column; + /* Stack player names vertically */ } .scores { display: flex; } -.scores span { +/* .score-span { width: 30px; /* Fixed width for each score cell */ - text-align: center; } -.separator { +*/ .separator { height: 1px; background-color: #707070; margin: 5px 0px; } .score { + display: inline-block; + font-size: 1.4em; vertical-align: middle; text-align: center; padding: 0px 5px; + /* width: 30px; */ } .winner { @@ -307,15 +321,19 @@ svg { .horizontal-padding { padding: 0px 20px; } + .horizontal-margin { margin: 0px 10px; } + .hpadding10 { padding: 0px 10px; } + .margin10 { margin: 10px; } + .left-margin { margin-left: 10px; } @@ -374,6 +392,7 @@ svg { .top-margin { margin-top: 10px; } + .top-margin20 { margin-top: 20px; } @@ -400,12 +419,15 @@ svg { .vertical-padding { padding: 8px 0px; } + .topmargin5 { margin-top: 5px; } + .topmargin10 { margin-top: 10px; } + .topmargin20 { margin-top: 20px; } @@ -440,6 +462,7 @@ svg { flex-grow: 1; text-align: right; } + .team_image { height: 40px; width: 40px; @@ -448,30 +471,39 @@ svg { .w15 { width: 15%; } + .w20 { width: 20%; } + .w25 { width: 25%; } + .w30 { width: 30%; } + .w40 { width: 40%; } + .w50 { width: 50%; } + .w60 { width: 60%; } + .w70 { width: 70%; } + .w80 { width: 80%; } + .w100 { width: 100%; } @@ -479,18 +511,27 @@ svg { .w20px { width: 20px; } + +.w30px { + width: 30px; +} + .w40px { width: 40px; } + .w60px { width: 60px; } + .w70px { width: 7px; } + .w80px { width: 80px; } + .w100px { width: 100px; } @@ -498,35 +539,44 @@ svg { .table-row-2-colums { display: grid; grid-template-columns: 2fr 60px; - align-items: center; /* Vertically center the content within each column */ + align-items: center; + /* Vertically center the content within each column */ padding: 5px 0px; } .table-row-2-colums-test { display: grid; grid-template-columns: 1px auto 100px; - align-items: center; /* Vertically center the content within each column */ + align-items: center; + /* Vertically center the content within each column */ padding: 5px 0px; } .table-row-3-colums { display: grid; grid-template-columns: auto 1fr auto; - align-items: center; /* Vertically center the content within each column */ + align-items: center; + /* Vertically center the content within each column */ padding: 5px 0px; } .table-row-4-colums { display: grid; - grid-template-columns: 1px auto 50px 70px 100px; /* first column is a hack */ - align-items: center; /* Vertically center the content within each column */ + grid-template-columns: 1px auto 50px 70px 100px; + /* first column is a hack */ + align-items: center; + /* Vertically center the content within each column */ padding: 5px 0px; } -@media print, screen and (min-width: 80em) { + +@media print, +screen and (min-width: 80em) { .table-row-4-colums { display: grid; - grid-template-columns: 1px auto 50px 70px 180px; /* first column is a hack */ - align-items: center; /* Vertically center the content within each column */ + grid-template-columns: 1px auto 50px 70px 180px; + /* first column is a hack */ + align-items: center; + /* Vertically center the content within each column */ padding: 5px 0px; } } @@ -534,7 +584,8 @@ svg { .table-row-5-colums { display: grid; grid-template-columns: 60px auto 50px 70px 130px; - align-items: center; /* Vertically center the content within each column */ + align-items: center; + /* Vertically center the content within each column */ padding: 5px 0px; } @@ -545,7 +596,8 @@ svg { } .table-cell-large { - grid-column: 2 / span 1; /* Center column spans from column 2 to column 3 */ + grid-column: 2 / span 1; + /* Center column spans from column 2 to column 3 */ text-align: left; } @@ -553,7 +605,8 @@ svg { display: flex; flex-direction: column; flex-wrap: wrap; - height: 100vh; /*the height will need to be customized*/ + height: 100vh; + /*the height will need to be customized*/ width: 50px; } diff --git a/tournaments/templates/tournaments/broadcasted_group_stages.html b/tournaments/templates/tournaments/broadcasted_group_stages.html index 1c514d5..e4a0548 100644 --- a/tournaments/templates/tournaments/broadcasted_group_stages.html +++ b/tournaments/templates/tournaments/broadcasted_group_stages.html @@ -78,62 +78,6 @@ {% include 'tournaments/broadcasted_group_stage.html' %} - diff --git a/tournaments/templates/tournaments/broadcasted_match.html b/tournaments/templates/tournaments/broadcasted_match.html index dd4b370..cbbb4ce 100644 --- a/tournaments/templates/tournaments/broadcasted_match.html +++ b/tournaments/templates/tournaments/broadcasted_match.html @@ -34,6 +34,13 @@ html += `'>` html += score html += `` + + if (match.has_walk_out) { + html += `` + if (team.walk_out) html += `WO` + html += `` + } + return html }, }" x-html="showScore(score, match.teams[i-1])"> @@ -42,6 +49,26 @@ + +
diff --git a/tournaments/templates/tournaments/broadcasted_matches.html b/tournaments/templates/tournaments/broadcasted_matches.html index 226c154..c7fe588 100644 --- a/tournaments/templates/tournaments/broadcasted_matches.html +++ b/tournaments/templates/tournaments/broadcasted_matches.html @@ -82,9 +82,9 @@