Fix: neue Züge wurden nicht angezeigt (Brett/Zugliste blieben in Startposition)

This commit is contained in:
2026-05-28 15:48:13 +02:00
parent c7633f5c7f
commit 9f320e2f91
2 changed files with 8 additions and 1 deletions

View File

@@ -53,7 +53,7 @@ function updateBoard() {
const nonResultMoves = currentGame.moves.filter(m => !m.isResult); const nonResultMoves = currentGame.moves.filter(m => !m.isResult);
if (currentMoveIndex >= nonResultMoves.length || currentMoveIndex < -1) { if (currentMoveIndex >= nonResultMoves.length || currentMoveIndex <= -1) {
currentMoveIndex = nonResultMoves.length - 1; currentMoveIndex = nonResultMoves.length - 1;
} else if (previousMoveCount >= 0 && currentMoveIndex === previousMoveCount - 1 && nonResultMoves.length > previousMoveCount) { } else if (previousMoveCount >= 0 && currentMoveIndex === previousMoveCount - 1 && nonResultMoves.length > previousMoveCount) {
currentMoveIndex = nonResultMoves.length - 1; currentMoveIndex = nonResultMoves.length - 1;

View File

@@ -48,6 +48,13 @@ async function loadPGN(showOverlay = true) {
const liveGame = getLiveGame(allLaraGames); const liveGame = getLiveGame(allLaraGames);
const todaysGames = getTodaysGames(allLaraGames); const todaysGames = getTodaysGames(allLaraGames);
currentGame = liveGame || (todaysGames.length > 0 ? getLatestGame(todaysGames) : getLatestGame(allLaraGames)); currentGame = liveGame || (todaysGames.length > 0 ? getLatestGame(todaysGames) : getLatestGame(allLaraGames));
} else if (currentGame) {
const updatedGame = allLaraGames.find(g =>
g.white === currentGame.white &&
g.black === currentGame.black &&
g.round === currentGame.round
);
if (updatedGame) currentGame = updatedGame;
} }
updateBoard(); updateBoard();
updatePlayerInfo(); updatePlayerInfo();