From 8b503be1440f81e12bb905d0a7d2e13e87af3cf6 Mon Sep 17 00:00:00 2001 From: bl3kunja Date: Wed, 12 Nov 2025 12:06:12 +0100 Subject: [PATCH] fixed calculator showing when league active and tournament unactive. --- templates/index.html | 7 ++++++- templates/tournament.html | 20 +++++++++++++++----- tv_app.py | 15 +++++++++++---- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/templates/index.html b/templates/index.html index d10dc23..2f604f9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -669,11 +669,16 @@
πŸ“‹ Oglej si Celoten Ε½reb Turnirja βš™οΈ Upravljaj Turnir - 🎯 Calculator
{% endif %} + {% if settings.tournament_active %} +
+ 🎯 Calculator +
+ {% endif %} +

Turnirji

diff --git a/templates/tournament.html b/templates/tournament.html index bb37e76..4796907 100644 --- a/templates/tournament.html +++ b/templates/tournament.html @@ -1487,7 +1487,7 @@ {% if tournament_state %} πŸ“‹ Draft {% endif %} - {% if league_state or tournament_state %} + {% if tournament_state %} 🎯 Results Calculator {% endif %}
@@ -2078,15 +2078,25 @@ function renderPlayerTable() { const tbody = document.getElementById('playerTableBody'); const noResults = document.getElementById('noResults'); + + // Check if playerTableBody exists before proceeding (it may not exist on all pages) + if (!tbody) { + return; + } + const filteredPlayers = getFilteredPlayers(); - + tbody.innerHTML = ''; - + if (filteredPlayers.length === 0) { - noResults.style.display = 'block'; + if (noResults) { + noResults.style.display = 'block'; + } return; } else { - noResults.style.display = 'none'; + if (noResults) { + noResults.style.display = 'none'; + } } filteredPlayers.forEach(player => { diff --git a/tv_app.py b/tv_app.py index b71edeb..549a56e 100644 --- a/tv_app.py +++ b/tv_app.py @@ -689,7 +689,7 @@ def index(): # Check if tournament is active and get current round players current_round_data = get_current_round_data() - + # If tournament is active, override camera titles with player names if current_round_data: tournament_titles = {} @@ -723,9 +723,16 @@ def index(): display_settings['tournament_active'] = False display_settings['current_round'] = 1 display_settings['total_rounds'] = 1 - display_settings['league_active'] = False - - + + # Check if league is active when tournament is not + league_state = load_league_state() + if league_state: + display_settings['league_active'] = True + display_settings['league_tournament'] = league_state.get('current_tournament', 1) + display_settings['league_total'] = league_state.get('total_tournaments', 6) + else: + display_settings['league_active'] = False + return render_template('index.html', streams=STREAMS, settings=display_settings,