From fad66afef8b13d63371c18c18af568d7930e4065 Mon Sep 17 00:00:00 2001 From: YourFriendlyNeighborhoodDealer Date: Wed, 6 Mar 2019 09:43:05 +0100 Subject: [PATCH] Question getting match percent fix, licence fix --- CHANGELOG | 5 +++++ license | 6 +++--- main.js | 10 +++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c46a375..6b44aca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,3 +4,8 @@ 1.6.1.0: Changed server domain name Fixed not found data file "brick" +1.6.1.5: + Question answering/getting/parsing improvements + Passive mode +1.6.1.6: + Fixed question saving match percent diff --git a/license b/license index f288702..27d7728 100644 --- a/license +++ b/license @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - Copyright (C) + Moodle test solver userscript + Copyright (C) 2019 YourFriendlyNeighborhoodDealer This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - Copyright (C) + Moodle Test solver userscript Copyright (C) 2019 YourFriendlyNeighborhoodDealer This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/main.js b/main.js index 852baf5..3ee51c1 100644 --- a/main.js +++ b/main.js @@ -39,6 +39,7 @@ var motd = ""; var lastestVersion = ""; const minMatchAmmount = 55; +const minResultMatchPercent = 99; const lengthDiffMultiplier = 10; //: Class descriptions {{{ @@ -1232,7 +1233,14 @@ function ShowSaveQuizDialog(addedQ, allQ, allOutput, output, sendSuccess, sentDa function SearchSameQuestion(questionData, quiz, i) { var r = questionData.Search(quiz[i].Q); - return r.length == 0 ? -1 : r.length; + + let count = 0; + r.forEach((item) => { + if (item.match > minResultMatchPercent) + count ++; + }); + + return count == 0 ? -1 : count; } // this should get the image url from a result page