Runde in PGN-URL (/pgn/{round}) und im Standings-Response
This commit is contained in:
8
app.js
8
app.js
@@ -15,6 +15,7 @@ let currentMoveIndex = -1;
|
||||
let userSelectedGame = false;
|
||||
let userScrolledMoves = false;
|
||||
let lastMtime = 0;
|
||||
let currentRound = 0;
|
||||
let pollId = 0;
|
||||
|
||||
/**
|
||||
@@ -26,8 +27,12 @@ async function loadPGN(showOverlay = true) {
|
||||
hideError();
|
||||
|
||||
try {
|
||||
if (currentRound === 0) {
|
||||
if (showOverlay) showLoading(false);
|
||||
return;
|
||||
}
|
||||
const [pgnResponse, statusResponse] = await Promise.all([
|
||||
fetch(`http://localhost:8111/pgn?since=${lastMtime}`),
|
||||
fetch(`http://localhost:8111/pgn/${currentRound}?since=${lastMtime}`),
|
||||
fetch('http://localhost:8111/status').catch(() => null)
|
||||
]);
|
||||
|
||||
@@ -382,6 +387,7 @@ function updateStandings() {
|
||||
return res.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data && data.round) currentRound = data.round;
|
||||
const container = document.getElementById('standings-content');
|
||||
if (!data || data.error) {
|
||||
container.innerHTML = '<div class="standings-loading">Daten nicht verfügbar</div>';
|
||||
|
||||
Reference in New Issue
Block a user