fix broadcast display name

tz
Raz 1 year ago
parent bd91119086
commit 6b584d940a
  1. 12
      tournaments/models/tournament.py
  2. 18
      tournaments/templates/tournaments/broadcast/broadcasted_auto.html
  3. 4
      tournaments/templates/tournaments/broadcast/broadcasted_group_stages.html
  4. 4
      tournaments/templates/tournaments/broadcast/broadcasted_matches.html
  5. 4
      tournaments/templates/tournaments/broadcast/broadcasted_rankings.html
  6. 4
      tournaments/templates/tournaments/broadcast/broadcasted_summons.html

@ -92,6 +92,18 @@ class Tournament(models.Model):
else: else:
return self.base_name() return self.base_name()
def broadcast_display_name(self):
if self.name:
return self.short_base_name() + " " + self.name
else:
return self.base_name()
def broadcast_event_display_name(self):
if self.event is not None:
return self.event.display_name()
else:
return " "
def base_name(self): def base_name(self):
return f"{self.level()} {self.category()}" return f"{self.level()} {self.category()}"

@ -37,7 +37,7 @@
paginatedGroupStages: null, paginatedGroupStages: null,
paginatedSummons: null, paginatedSummons: null,
active: 1, active: 1,
title: '', prefixTitle: '',
retrieveData() { retrieveData() {
fetch('/tournament/{{ tournament.id }}/broadcast/json/') fetch('/tournament/{{ tournament.id }}/broadcast/json/')
.then(res => res.json()) .then(res => res.json())
@ -45,7 +45,7 @@
this.paginatedMatches = this.paginate(data.matches, 8) this.paginatedMatches = this.paginate(data.matches, 8)
this.paginatedGroupStages = this.paginate(data.group_stages, 4) this.paginatedGroupStages = this.paginate(data.group_stages, 4)
this.paginatedSummons = this.paginateSummons(data.summons) this.paginatedSummons = this.paginateSummons(data.summons)
this.setTitle() this.setPrefixTitle()
}) })
}, },
paginateSummons(array) { paginateSummons(array) {
@ -76,19 +76,19 @@
setInterval(() => { setInterval(() => {
this.retrieveData() this.retrieveData()
this.active = this.active === this.pageCount() ? 1 : this.active+1 this.active = this.active === this.pageCount() ? 1 : this.active+1
this.setTitle() this.setPrefixTitle()
}, 15000) }, 15000)
}, },
pageCount() { pageCount() {
return this.paginatedMatches.length + this.paginatedGroupStages.length + this.paginatedSummons.length return this.paginatedMatches.length + this.paginatedGroupStages.length + this.paginatedSummons.length
}, },
setTitle() { setPrefixTitle() {
if (this.active < 1 + this.paginatedSummons.length) { if (this.active < 1 + this.paginatedSummons.length) {
this.title = 'Convocations' this.prefixTitle = 'Convocations'
} else if (this.active < 1 + this.paginatedSummons.length + this.paginatedMatches.length) { } else if (this.active < 1 + this.paginatedSummons.length + this.paginatedMatches.length) {
this.title = 'Matchs' this.prefixTitle = 'Matchs'
} else { } else {
this.title = 'Poules' this.prefixTitle = 'Poules'
} }
} }
@ -104,8 +104,8 @@
class="logo inline" class="logo inline"
/> />
<div class="inline"> <div class="inline">
<h1 class="club">{{ tournament.display_name }}</h1> <h1 class="club">{{ tournament.broadcast_event_display_name }}</h1>
<h1 class="event"><span x-text="title"></span></h1> <h1 class="event"><span x-text="prefixTitle"></span> {{ tournament.broadcast_display_name }}</h1>
<!-- <span>Propulsé par Padel Club</span> --> <!-- <span>Propulsé par Padel Club</span> -->
</div> </div>
</div> </div>

@ -67,8 +67,8 @@
<div class="left-content bubble"> <div class="left-content bubble">
<img src="{% static 'tournaments/images/PadelClub_logo_512.png' %}" alt="logo" class="logo"> <img src="{% static 'tournaments/images/PadelClub_logo_512.png' %}" alt="logo" class="logo">
<div class="left-margin"> <div class="left-margin">
<h1 class="club">{{ tournament.display_name }}</h1> <h1 class="club">{{ tournament.broadcast_event_display_name }}</h1>
<h1 class="event">Poules</h1> <h1 class="event">Poules {{ tournament.broadcast_display_name }}</h1>
</div> </div>
</div> </div>
<div class="right-content">{% qr_from_text qr_code_url options=qr_code_options %}</div> <div class="right-content">{% qr_from_text qr_code_url options=qr_code_options %}</div>

@ -67,8 +67,8 @@
<div class="left-content bubble"> <div class="left-content bubble">
<img src="{% static 'tournaments/images/PadelClub_logo_512.png' %}" alt="logo" class="logo"> <img src="{% static 'tournaments/images/PadelClub_logo_512.png' %}" alt="logo" class="logo">
<div class="left-margin"> <div class="left-margin">
<h1 class="club">{{ tournament.display_name }}</h1> <h1 class="club">{{ tournament.broadcast_event_display_name }}</h1>
<h1 class="event">Matchs</h1> <h1 class="event">Matchs {{ tournament.broadcast_display_name }}</h1>
</div> </div>
</div> </div>
<div class="right-content">{% qr_from_text qr_code_url options=qr_code_options %}</div> <div class="right-content">{% qr_from_text qr_code_url options=qr_code_options %}</div>

@ -1,8 +1,8 @@
{% extends 'tournaments/broadcast/broadcast_base.html' %} {% extends 'tournaments/broadcast/broadcast_base.html' %}
{% block head_title %}Classement{% endblock %} {% block head_title %}Classement{% endblock %}
{% block first_title %}{{ tournament.display_name }}{% endblock %} {% block first_title %}{{ tournament.broadcast_event_display_name }}{% endblock %}
{% block second_title %}Classement{% endblock %} {% block second_title %}Classement {{ tournament.broadcast_display_name }}{% endblock %}
{% block content %} {% block content %}

@ -1,8 +1,8 @@
{% extends 'tournaments/broadcast/broadcast_base.html' %} {% extends 'tournaments/broadcast/broadcast_base.html' %}
{% block head_title %}Convocations{% endblock %} {% block head_title %}Convocations{% endblock %}
{% block first_title %}{{ tournament.display_name }}{% endblock %} {% block first_title %}{{ tournament.broadcast_event_display_name }}{% endblock %}
{% block second_title %}Convocations{% endblock %} {% block second_title %}Convocations {{ tournament.broadcast_display_name }}{% endblock %}
{% block content %} {% block content %}

Loading…
Cancel
Save