fix issue with court display in broadcast planning and prog not displaying in

player website
sync_v2
Razmig Sarkissian 6 months ago
parent 30ca0ef20c
commit 7a0983b0a0
  1. 11
      tournaments/models/tournament.py
  2. 18
      tournaments/templates/tournaments/broadcast/broadcasted_planning.html
  3. 4
      tournaments/templates/tournaments/prog.html

@ -906,6 +906,8 @@ class Tournament(BaseModel):
return self.has_team_registrations()
if self.has_started():
return self.has_team_registrations()
if self.will_start_soon(1):
return True
return False
def display_prog(self):
@ -915,6 +917,8 @@ class Tournament(BaseModel):
return True
if self.has_started():
return True
if self.will_start_soon(1):
return True
return False
def has_team_registrations(self):
@ -927,6 +931,8 @@ class Tournament(BaseModel):
return self.has_summons()
if self.has_started():
return self.has_summons()
if self.will_start_soon(1):
return True
return False
def display_group_stages(self):
@ -2090,6 +2096,11 @@ class Tournament(BaseModel):
def localized_start_time(self):
return formats.date_format(self.local_start_date(), format='H:i').capitalize()
def court_names(self):
if self.event.club is None:
return [f"Piste {i+1}" for i in range(self.court_count)]
return [f"{self.event.club.court_name(i)}" for i in range(self.court_count)]
class MatchGroup:
def __init__(self, name, matches, formatted_schedule, round_id=None, round_index=None):
self.name = name

@ -151,6 +151,7 @@
has_sponsors: {{ tournament.has_sponsors|lower }},
matchGroups: [],
courtCount: {{ tournament.court_count|default:1 }},
courtNames: {{ tournament.court_names }},
retrieveData() {
fetch('/tournament/{{ tournament.id }}/planning/json/')
.then(res => res.json())
@ -211,10 +212,9 @@
return paginatedGroups;
},
getCourtNumber(courtName) {
if (!courtName) return 999;
const match = courtName.match(/(\d+)/);
return match ? parseInt(match[1]) : 999;
getCourtNumber(courtIndex) {
if (!courtIndex) return 999;
return courtIndex;
},
organizeMatchesByCourt(matches) {
@ -222,7 +222,7 @@
if (matches && matches.length > 0) {
matches.forEach(match => {
if (match && match.court) {
const courtNum = this.getCourtNumber(match.court);
const courtNum = this.getCourtNumber(match.court_index);
if (courtNum > 0 && courtNum <= this.courtCount) {
courtMatches[courtNum - 1] = match;
}
@ -289,10 +289,10 @@
<h1 class="timeslot">00:00</h1>
</div>
<div class="courts-row" style="margin-left: 10px; margin-bottom: -10px;">
<template x-for="courtNum in Array.from({length: courtCount || 1}, (_, i) => i + 1)" :key="courtNum">
<template x-for="courtName in courtNames" :key="courtName">
<div class="court-label" :style="{'width': calculateFractionWidth()}">
<div class="bubble">
<div class="score ws bold">Piste <span x-text="courtNum"></span></div>
<div class="score ws bold"><span x-text="courtName"></span></div>
</div>
</div>
</template>
@ -305,10 +305,10 @@
<h1 class="timeslot">00:00</h1>
</div>
<div class="courts-row" style="margin-bottom: -10px;">
<template x-for="courtNum in Array.from({length: courtCount || 1}, (_, i) => i + 1)" :key="courtNum">
<template x-for="courtName in courtNames" :key="courtName">
<div class="court-label" :style="{'width': calculateFractionWidth()}">
<div class="bubble">
<div class="score ws bold">Piste <span x-text="courtNum"></span></div>
<div class="score ws bold"><span x-text="courtName"></span></div>
</div>
</div>
</template>

@ -5,9 +5,9 @@
{% block second_title %}Programmation{% endblock %}
{% block content %}
{% include 'tournaments/navigation_tournament.html' %}
{% if tournament.display_prog %}
{% include 'tournaments/navigation_tournament.html' %}
{% if tournament.display_matches %}
{% if days %}
<nav class="margin10">
{% for day in days %}

Loading…
Cancel
Save