fix broadcast auto, add rankings to broadcast auto

tz
Raz 1 year ago
parent 2f314d7a95
commit ccb9cf0b27
  1. 19
      tournaments/models/tournament.py
  2. 13
      tournaments/static/tournaments/css/broadcast.css
  3. 65
      tournaments/templates/tournaments/broadcast/broadcasted_auto.html
  4. 6
      tournaments/templates/tournaments/broadcast/broadcasted_ranking.html
  5. 7
      tournaments/templates/tournaments/broadcast/broadcasted_rankings.html

@ -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,6 +459,16 @@ 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]
@ -465,6 +476,7 @@ class Tournament(models.Model):
'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()

@ -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";
}

@ -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()">
<div class="wrapper">
<header>
<div class="grid-x">
<div class="cell medium-6 large-6 topblock my-block">
<div id="header">
<div class="left-content bubble">
<img
src="{% static 'tournaments/images/PadelClub_logo_512.png' %}"
class="logo inline"
/>
<div class="inline">
<img src="{% static 'tournaments/images/PadelClub_logo_512.png' %}" alt="logo" class="logo">
<div class="left-margin">
<h1 class="club">{{ tournament.broadcast_event_display_name }}</h1>
<h1 class="event"><span x-text="prefixTitle"></span> {{ tournament.broadcast_display_name }}</h1>
<!-- <span>Propulsé par Padel Club</span> -->
</div>
</div>
</div>
<div class="cell medium-6 large-6 topblock my-block">
<div class="right">
{% qr_from_text qr_code_url options=qr_code_options %}
</div>
</div >
</div>
{% if qr_code_options %}
<div class="right-content">{% qr_from_text qr_code_url options=qr_code_options %}</div>
{% endif %}
</div>
</header>
<main>
<div class="wrapper">
<main>
<div class="grid-x">
<template x-for="i in paginatedSummons.length">
@ -146,6 +162,13 @@
</template>
</template>
<template x-for="i in paginatedRankings.length">
<template x-for="column in paginatedRankings[i-1]">
<div class="cell medium-6 large-6 topblock my-block" x-show="active === i + paginatedSummons.length + paginatedMatches.length + paginatedGroupStages.length">
{% include 'tournaments/broadcast/broadcasted_ranking.html' %}
</div>
</template>
</template>
</div>
</main>

@ -1,5 +1,5 @@
{% load static %}
<div class="bubble">
<template x-for="(ranking, index) in column" >
<div>
<div class="table-row-3-colums-ranks">
@ -18,3 +18,5 @@
<hr/>
</div>
</div>
</template>
</div>

@ -54,14 +54,7 @@
<template x-for="i in paginatedRankings.length" >
<template x-for="column in paginatedRankings[i-1]" >
<div class="cell medium-6 large-6 topblock my-block" x-show="active === i">
<div class="bubble">
<template x-for="(ranking, index) in column" >
{% include 'tournaments/broadcast/broadcasted_ranking.html' %}
</template>
</div>
</div>
</template>
</template>

Loading…
Cancel
Save