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