saving issue fixed

This commit is contained in:
bl3kunja-FW
2025-11-11 17:34:42 +01:00
parent 23dc5673ee
commit fd44ca7128
4 changed files with 58 additions and 24 deletions
+18 -2
View File
@@ -1305,10 +1305,26 @@
if (response.ok) {
const responseData = await response.json();
// Always show results first when tournament finishes
// Determine where to redirect based on tournament type and archive
let redirectUrl = '/results';
// Priority 1: If league finished, redirect to league archive
if (responseData.league_archived && responseData.league_archive_filename) {
redirectUrl = `/archive/league/${responseData.league_archive_filename}`;
}
// Priority 2: If standalone tournament, redirect to tournament archive
else if (responseData.archived && responseData.archive_filename) {
redirectUrl = `/archive/tournament/${responseData.archive_filename}`;
}
// Priority 3: If league tournament (not final), show league standings
else if (responseData.league && !responseData.league_finished) {
redirectUrl = '/results'; // This will show league standings with current tournament
}
// Always show results after tournament finishes
alert('Tournament finished successfully! Showing results...');
setTimeout(() => {
window.location.href = '/results';
window.location.href = redirectUrl;
}, 1000);
} else {
const error = await response.json();
+10 -2
View File
@@ -1505,7 +1505,7 @@
<div class="league-tournament-card league">
<h3>🏆 <span data-i18n="league.league_active">Liga (Aktivna)</span></h3>
<div class="unified-status league">
<span data-i18n="league.league_active">Liga je Aktivna</span> - {{ league_state.completed_tournaments|length }}/{{ league_state.total_tournaments }} <span data-i18n="tournament.completed">Zaključeno</span>
<span data-i18n="league.league_active">Liga je Aktivna</span>
</div>
<div class="compact-info-grid">
<div class="compact-info-item">
@@ -1533,7 +1533,7 @@
<!-- Tournament Progress Timeline -->
<div class="rounds-progress-bar">
<div class="rounds-progress-title">
📊 <span data-i18n="league.tournaments">Turnirji</span> - {{ league_state.completed_tournaments|length }}/{{ league_state.total_tournaments }}
📊 <span data-i18n="league.tournaments">Turnirji</span>
</div>
<div class="rounds-progress-horizontal">
{% for i in range(1, league_state.total_tournaments + 1) %}
@@ -2650,6 +2650,14 @@
console.log('🏆 Tournament Management loaded');
console.log('League active:', leagueActive);
console.log('Tournament active:', tournamentActive);
{% if league_state %}
console.log('📊 League State Debug:');
console.log(' - Completed tournaments:', {{ league_state.completed_tournaments|length }});
console.log(' - Total tournaments:', {{ league_state.total_tournaments }});
console.log(' - Current tournament:', {{ league_state.current_tournament }});
console.log(' - Completed list:', {{ league_state.completed_tournaments|tojson }});
{% endif %}
}, { once: true });
});
</script>