From 8476a7c594455def355c1acb82475fc1f1a9aff7 Mon Sep 17 00:00:00 2001 From: Miodec Date: Fri, 25 Feb 2022 20:38:54 +0100 Subject: [PATCH] fixed wikipedia not adding words correctly closes #2566 --- frontend/src/scripts/test/test-logic.js | 44 ++++++++++++------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/frontend/src/scripts/test/test-logic.js b/frontend/src/scripts/test/test-logic.js index 501b16848..3dafe1122 100644 --- a/frontend/src/scripts/test/test-logic.js +++ b/frontend/src/scripts/test/test-logic.js @@ -986,29 +986,6 @@ export async function init() { export async function addWord() { let bound = 100; - if (Config.funbox === "wikipedia" || Config.funbox == "poetry") { - if ( - Config.mode == "time" && - TestWords.words.length - TestWords.words.currentIndex < 20 - ) { - let section = - Config.funbox == "wikipedia" - ? await Wikipedia.getSection(Config.language) - : await Poetry.getPoem(); - let wordCount = 0; - for (let word of section.words) { - if (wordCount >= Config.words && Config.mode == "words") { - break; - } - wordCount++; - TestWords.words.push(word); - TestUI.addWord(word); - } - } else { - return; - } - } - if (Config.funbox === "plus_one") bound = 1; if (Config.funbox === "plus_two") bound = 2; if ( @@ -1028,6 +1005,27 @@ export async function addWord() { TestWords.words.length >= TestWords.randomQuote.textSplit.length) ) return; + + if (Config.funbox === "wikipedia" || Config.funbox == "poetry") { + if (TestWords.words.length - TestWords.words.currentIndex < 20) { + let section = + Config.funbox == "wikipedia" + ? await Wikipedia.getSection(Config.language) + : await Poetry.getPoem(); + let wordCount = 0; + for (let word of section.words) { + if (wordCount >= Config.words && Config.mode == "words") { + break; + } + wordCount++; + TestWords.words.push(word); + TestUI.addWord(word); + } + } else { + return; + } + } + const language = Config.mode !== "custom" ? await Misc.getCurrentLanguage(Config.language)