From 9f320e2f9109979f002fbd56e13064ca69284fe3 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 28 May 2026 15:48:13 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20neue=20Z=C3=BCge=20wurden=20nicht=20ange?= =?UTF-8?q?zeigt=20(Brett/Zugliste=20blieben=20in=20Startposition)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/board.js | 2 +- js/data.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/js/board.js b/js/board.js index 266c347..91779da 100644 --- a/js/board.js +++ b/js/board.js @@ -53,7 +53,7 @@ function updateBoard() { const nonResultMoves = currentGame.moves.filter(m => !m.isResult); - if (currentMoveIndex >= nonResultMoves.length || currentMoveIndex < -1) { + if (currentMoveIndex >= nonResultMoves.length || currentMoveIndex <= -1) { currentMoveIndex = nonResultMoves.length - 1; } else if (previousMoveCount >= 0 && currentMoveIndex === previousMoveCount - 1 && nonResultMoves.length > previousMoveCount) { currentMoveIndex = nonResultMoves.length - 1; diff --git a/js/data.js b/js/data.js index 7e09ca3..e745f62 100644 --- a/js/data.js +++ b/js/data.js @@ -48,6 +48,13 @@ async function loadPGN(showOverlay = true) { const liveGame = getLiveGame(allLaraGames); const todaysGames = getTodaysGames(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(); updatePlayerInfo();