From e34d79e5658dcce20f27b048fd083e8a8fb51d93 Mon Sep 17 00:00:00 2001 From: jamulix Date: Tue, 21 Oct 2025 21:03:22 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Verwende=20aktuelle=20Zeile=20statt=20ge?= =?UTF-8?q?samter=20Lektion=20f=C3=BCr=20Statistiken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: aider (deepseek/deepseek-reasoner) --- static/js/script.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/static/js/script.js b/static/js/script.js index fc8d3b1..4a39e01 100644 --- a/static/js/script.js +++ b/static/js/script.js @@ -12,8 +12,7 @@ document.addEventListener('DOMContentLoaded', function() { const totalElement = document.getElementById('total'); const wpmElement = document.getElementById('wpm'); - // Aktuelle Textdaten - let currentText = window.initialText; + // Aktuelle Textdaten (verwende nur lines, entferne currentText) let lines = window.lines; let currentLineIndex = window.currentLineIndex; let startTime = null; @@ -66,7 +65,8 @@ document.addEventListener('DOMContentLoaded', function() { function updateTimer() { if (startTime) { const userValue = userInput.value; - updateStatistics(userValue, currentText); + const currentLine = lines[currentLineIndex]; + updateStatistics(userValue, currentLine); } } @@ -95,8 +95,8 @@ document.addEventListener('DOMContentLoaded', function() { if (data.error) { alert('Fehler: ' + data.error); } else { - currentText = data.text; - lines = currentText.split('\n'); + // Verwende nur lines, entferne currentText + lines = data.text.split('\n'); currentLineIndex = 0; updateLineDisplay(); document.getElementById('lesson-title').textContent = data.title; @@ -126,8 +126,8 @@ document.addEventListener('DOMContentLoaded', function() { }) .then(response => response.json()) .then(data => { - currentText = data.text; - lines = currentText.split('\n'); + // Verwende nur lines, entferne currentText + lines = data.text.split('\n'); currentLineIndex = 0; updateLineDisplay(); // Aktualisiere den Lektionstitel