+
-
diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index d513713..1977d31 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -451,6 +451,7 @@ class Tournament(models.Model): 'matches': [], 'group_stages': group_stages_dicts, 'summons': team_summons_dicts, + 'rankings' : [] } else: live_matches_dicts = [match.live_match().to_dict() for match in matches] @@ -458,13 +459,24 @@ class Tournament(models.Model): 'matches': live_matches_dicts, 'group_stages': [], 'summons': team_summons_dicts, + 'rankings' : [] } + elif self.end_date is not None: + live_matches_dicts = [match.live_match().to_dict() for match in matches] + team_rankings_dicts = [ranking.to_dict() for ranking in self.rankings()] + return { + 'matches': live_matches_dicts, + 'group_stages': [], + 'summons': [], + 'rankings' : team_rankings_dicts + } else: # we want to display the broadcasted content live_matches_dicts = [match.live_match().to_dict() for match in matches] return { 'matches': live_matches_dicts, 'group_stages': group_stages_dicts, 'summons': [], + 'rankings' : [] } def broadcasted_matches_and_group_stages(self): @@ -479,19 +491,26 @@ class Tournament(models.Model): matches.extend(first_round.get_matches_recursive(True)) else: current_round = self.round_to_show() + print("current_round", current_round) if current_round: # Add full matches from the next rounds + print("Add full matches from the next rounds") next_round = self.round_for_index(current_round.index - 1) if next_round: + print("next_round", next_round) matches.extend(next_round.get_matches_recursive(True)) # Add matches from the previous round or group_stages + print("Add matches from the previous round or group_stages") previous_round = self.round_for_index(current_round.index + 1) if previous_round: + print("previous_round", previous_round) + print('test 1') matches.extend(current_round.get_matches_recursive(True)) matches.extend(previous_round.get_matches_recursive(True)) else: + print("else") matches.extend(current_round.all_matches(True)) group_stages = self.live_group_stages() diff --git a/tournaments/static/tournaments/css/broadcast.css b/tournaments/static/tournaments/css/broadcast.css index 1100a31..ffd1f78 100644 --- a/tournaments/static/tournaments/css/broadcast.css +++ b/tournaments/static/tournaments/css/broadcast.css @@ -22,19 +22,6 @@ body { box-shadow: 0 0 0px 0px #fbead6; } -.headerbubble { - padding: 20px; - background-color: white; - border-radius: 24px; - box-shadow: 0 0 0px 0px #fbead6; - display: inline-block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - max-width: 120%; /* Allow bubble to take full width */ - box-sizing: border-box; /* Include padding in the width calculation */ -} - .bold { font-family: "Montserrat-Bold"; } diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_auto.html b/tournaments/templates/tournaments/broadcast/broadcasted_auto.html index 3712a83..a20e5fb 100644 --- a/tournaments/templates/tournaments/broadcast/broadcasted_auto.html +++ b/tournaments/templates/tournaments/broadcast/broadcasted_auto.html @@ -36,6 +36,7 @@ paginatedMatches: null, paginatedGroupStages: null, paginatedSummons: null, + paginatedRankings: null, active: 1, prefixTitle: '', retrieveData() { @@ -45,11 +46,33 @@ this.paginatedMatches = this.paginate(data.matches, 8) this.paginatedGroupStages = this.paginate(data.group_stages, 4) this.paginatedSummons = this.paginateSummons(data.summons) + this.paginatedRankings = this.paginateRankings(data.rankings) this.setPrefixTitle() + + // Adjust active if it exceeds the new page count + if (this.active > this.pageCount()) { + this.active = 1; // Reset to the first page + } }) }, paginateSummons(array) { - let pageSize = 20 + let pageSize = 16 + pages = this.paginate(array, pageSize) + + const splitGroups = [] + pages.forEach(group => { + const firstHalf = group.slice(0, pageSize / 2) + const secondHalf = group.slice(pageSize / 2) + if (secondHalf.length > 0) { + splitGroups.push([firstHalf, secondHalf]) + } else { + splitGroups.push([firstHalf]) + } + }); + return splitGroups + }, + paginateRankings(array) { + let pageSize = 16 pages = this.paginate(array, pageSize) const splitGroups = [] @@ -80,46 +103,39 @@ }, 15000) }, pageCount() { - return this.paginatedMatches.length + this.paginatedGroupStages.length + this.paginatedSummons.length + return this.paginatedMatches.length + this.paginatedGroupStages.length + this.paginatedSummons.length + this.paginatedRankings.length }, setPrefixTitle() { if (this.active < 1 + this.paginatedSummons.length) { this.prefixTitle = 'Convocations' } else if (this.active < 1 + this.paginatedSummons.length + this.paginatedMatches.length) { this.prefixTitle = 'Matchs' - } else { + } else if (this.active < 1 + this.paginatedSummons.length + this.paginatedMatches.length + this.paginatedGroupStages.length) { this.prefixTitle = 'Poules' + } else { + this.prefixTitle = 'Classement' } } }" x-init="loop()"> - -
-
+