mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Removed unused function
This commit is contained in:
parent
e189f945de
commit
5b02f2494d
1 changed files with 0 additions and 17 deletions
17
main.js
17
main.js
|
@ -1553,23 +1553,6 @@ function AddVideoHotkeys(url) {
|
||||||
node.style.margin = "5px 5px 5px 5px"; // fancy margin
|
node.style.margin = "5px 5px 5px 5px"; // fancy margin
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetMatchPercent(currData, questionParts) {
|
|
||||||
var currQuestion = SUtils.SimplifyQuery(currData.q); // current question simplified
|
|
||||||
var match = 0; // how many times the current question matches the current question in the database
|
|
||||||
for (var i = 0; i < questionParts.length; i++) // going through the question parts
|
|
||||||
{
|
|
||||||
if (currQuestion.includes(questionParts[i])) // if the current question from questionData includes one of the question parts
|
|
||||||
{
|
|
||||||
match++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var percent = Math.round(((match / questionParts.length) * 100).toFixed(2)); // matched words percent
|
|
||||||
var lengthDifference = RemoveMultipleItems(SUtils.SimplifyQuery(currQuestion).split(" ")).length -
|
|
||||||
questionParts.length;
|
|
||||||
percent -= Math.abs(lengthDifference) * 2;
|
|
||||||
return percent;
|
|
||||||
}
|
|
||||||
|
|
||||||
// simple sort.
|
// simple sort.
|
||||||
function SortByPercent(results) {
|
function SortByPercent(results) {
|
||||||
for (var i = 0; i < results.length; i++) {
|
for (var i = 0; i < results.length; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue