bracket-feature
laurent 1 year ago
commit b5bcaf93ec
  1. 20
      tournaments/templates/tournaments/broadcast/broadcasted_auto_event.html
  2. 1
      tournaments/views.py

@ -48,6 +48,23 @@
fetch(`/tournament/${activeTournamentId}/broadcast/json/`)
.then(res => res.json())
.then((data) => {
const hasContent = data.matches.length > 0 || data.group_stages.length > 0 || data.summons.length > 0 || data.rankings.length > 0;
if (!hasContent) {
console.warn(`Tournament ${activeTournamentId} has no content, skipping.`);
// Move to the next tournament and retry fetching data
this.activeTournamentIndex = (this.activeTournamentIndex + 1) % this.tournamentIds.length;
this.retrieveDataForActiveTournament(); // Recursively fetch the next tournament
if (this.activeTournamentIndex === this.tournamentIds.length - 1) {
this.prefixTitle = ''
this.eventTitle = '{{ club_name }}'
this.title = 'Aucun tournoi en cours'
}
return;
}
console.log('Fetched Data:', data); // Add this to debug the fetch result
this.paginatedMatches = this.paginate(data.matches, 8);
this.paginatedGroupStages = this.paginate(data.group_stages, 4);
@ -56,7 +73,6 @@
this.setPrefixTitle();
this.eventTitle = data.event_title
this.title = data.tournament_title
if (this.active > this.pageCount()) {
this.active = 1;
}
@ -154,7 +170,7 @@
this.prefixTitle = 'Matchs';
} else if (this.active < 1 + this.paginatedSummons.length + this.paginatedMatches.length + this.paginatedGroupStages.length) {
this.prefixTitle = 'Poules';
} else {
} else if (paginatedRankings.length > 0) {
this.prefixTitle = 'Classement';
}
}

@ -346,6 +346,7 @@ def club_broadcast_auto(request, broadcast_code):
#print(tournament_ids)
return render(request, 'tournaments/broadcast/broadcasted_auto_event.html', {
'tournament_ids': tournament_ids,
'club_name': club.name
})
def download(request):

Loading…
Cancel
Save