Fix: loadPGN ruft updateStandings() vor currentRound-Check auf, damit Requests tatsächlich ausgeführt werden

This commit is contained in:
2026-05-24 15:49:56 +02:00
parent 638ef0360f
commit 812cd3b24f

19
app.js
View File

@@ -27,6 +27,9 @@ async function loadPGN(showOverlay = true) {
hideError();
try {
// Zuerst Tabelle abrufen, um die aktuelle Runde zu ermitteln
await updateStandings();
if (currentRound === 0) {
if (showOverlay) showLoading(false);
return;
@@ -70,7 +73,6 @@ async function loadPGN(showOverlay = true) {
updateMovesList();
updateAllGamesList();
updateTimestamp();
updateStandings();
showLoading(false);
@@ -380,13 +382,11 @@ function updateAllGamesList() {
/**
* Lädt die Turniertabelle vom Proxy und zeigt Laras Platzierung an
*/
function updateStandings() {
fetch('http://localhost:8111/standings')
.then(res => {
async function updateStandings() {
try {
const res = await fetch('http://localhost:8111/standings');
if (!res.ok) throw new Error('Fehler beim Laden');
return res.json();
})
.then(data => {
const data = await res.json();
if (data && data.round) currentRound = data.round;
const container = document.getElementById('standings-content');
if (!data || data.error) {
@@ -414,11 +414,10 @@ function updateStandings() {
<span class="standings-value">${data.losses}</span>
</div>
`;
})
.catch(err => {
} catch (err) {
document.getElementById('standings-content').innerHTML =
'<div class="standings-loading">Daten nicht verfügbar</div>';
});
}
}
/**