From d2390746003fb17d03f543b468fa15662df39643 Mon Sep 17 00:00:00 2001 From: Miodec Date: Sat, 13 Mar 2021 02:36:01 +0000 Subject: [PATCH] potentially fixed the 'result data does not make sense' error --- src/js/script.js | 1 + src/js/test/test-stats.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/js/script.js b/src/js/script.js index 8b3b197dc..a8435e1e2 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -2681,6 +2681,7 @@ function startTest() { } testActive = true; TestStats.setStart(performance.now()); + TestStats.resetKeypressTimings(); restartTimer(); showTimer(); $("#liveWpm").text("0"); diff --git a/src/js/test/test-stats.js b/src/js/test/test-stats.js index 13eca2dc7..f0a68d707 100644 --- a/src/js/test/test-stats.js +++ b/src/js/test/test-stats.js @@ -180,6 +180,19 @@ export function setKeypressSpacing(val) { keypressTimings.spacing.current = val; } +export function resetKeypressTimings() { + keypressTimings = { + spacing: { + current: -1, + array: [], + }, + duration: { + current: -1, + array: [], + }, + }; +} + export function pushMissedWord(word) { if (!Object.keys(missedWords).includes(word)) { missedWords[word] = 1;