From d1fbc21c1ebfcf4dfb673d9cb411c0415f9045e3 Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 8 Sep 2022 14:10:14 +0200 Subject: [PATCH] converting to lowercase if punctuation is disabled instead of regenerating --- frontend/src/ts/test/test-logic.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/ts/test/test-logic.ts b/frontend/src/ts/test/test-logic.ts index 158696402..c855e11cf 100644 --- a/frontend/src/ts/test/test-logic.ts +++ b/frontend/src/ts/test/test-logic.ts @@ -807,10 +807,7 @@ async function getNextWord( let regenarationCount = 0; //infinite loop emergency stop button while ( regenarationCount < 100 && - ((Config.mode !== "custom" && - /[A-Z]/.test(randomWord) && - !Config.punctuation) || - previousWord == randomWord || + (previousWord == randomWord || previousWord2 == randomWord || (Config.mode !== "custom" && !Config.punctuation && @@ -827,6 +824,14 @@ async function getNextWord( } } + if ( + Config.mode !== "custom" && + /[A-Z]/.test(randomWord) && + !Config.punctuation + ) { + randomWord = randomWord.toLowerCase(); + } + if (randomWord === undefined) { randomWord = wordset.randomWord(); }