|
|
|
@ -48,6 +48,23 @@ |
|
|
|
fetch(`/tournament/${activeTournamentId}/broadcast/json/`) |
|
|
|
fetch(`/tournament/${activeTournamentId}/broadcast/json/`) |
|
|
|
.then(res => res.json()) |
|
|
|
.then(res => res.json()) |
|
|
|
.then((data) => { |
|
|
|
.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 |
|
|
|
console.log('Fetched Data:', data); // Add this to debug the fetch result |
|
|
|
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); |
|
|
|
@ -56,7 +73,6 @@ |
|
|
|
this.setPrefixTitle(); |
|
|
|
this.setPrefixTitle(); |
|
|
|
this.eventTitle = data.event_title |
|
|
|
this.eventTitle = data.event_title |
|
|
|
this.title = data.tournament_title |
|
|
|
this.title = data.tournament_title |
|
|
|
|
|
|
|
|
|
|
|
if (this.active > this.pageCount()) { |
|
|
|
if (this.active > this.pageCount()) { |
|
|
|
this.active = 1; |
|
|
|
this.active = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -154,7 +170,7 @@ |
|
|
|
this.prefixTitle = 'Matchs'; |
|
|
|
this.prefixTitle = 'Matchs'; |
|
|
|
} else if (this.active < 1 + this.paginatedSummons.length + this.paginatedMatches.length + this.paginatedGroupStages.length) { |
|
|
|
} else if (this.active < 1 + this.paginatedSummons.length + this.paginatedMatches.length + this.paginatedGroupStages.length) { |
|
|
|
this.prefixTitle = 'Poules'; |
|
|
|
this.prefixTitle = 'Poules'; |
|
|
|
} else { |
|
|
|
} else if (paginatedRankings.length > 0) { |
|
|
|
this.prefixTitle = 'Classement'; |
|
|
|
this.prefixTitle = 'Classement'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|