mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Removing + from questions
This commit is contained in:
parent
6cee318903
commit
dc3e8f5391
1 changed files with 11 additions and 8 deletions
|
@ -21,7 +21,7 @@
|
|||
|
||||
// ==UserScript==
|
||||
// @name Moodle/Elearning/KMOOC test help
|
||||
// @version 1.6.4.7
|
||||
// @version 1.6.4.8
|
||||
// @description Online Moodle/Elearning/KMOOC test help
|
||||
// @author MrFry
|
||||
// @match https://elearning.uni-obuda.hu/main/*
|
||||
|
@ -82,7 +82,8 @@
|
|||
'The correct answer is:',
|
||||
'\''
|
||||
]
|
||||
const commonUselessStringParts = [',', '\\.', ':', '!']
|
||||
const commonUselessStringParts = [',', '\\.', ':', '!', '\\+']
|
||||
const specialChars = [ '&', '\\+' ]
|
||||
const lengthDiffMultiplier = 10 /* Percent minus for length difference */
|
||||
const minMatchAmmount = 60 /* Minimum ammount to consider that two questions match during answering */
|
||||
|
||||
|
@ -91,10 +92,10 @@
|
|||
}
|
||||
|
||||
class StringUtils {
|
||||
RemoveStuff (value, removableStrings) {
|
||||
RemoveStuff (value, removableStrings, toReplace) {
|
||||
removableStrings.forEach((x) => {
|
||||
var regex = new RegExp(x, 'g')
|
||||
value = value.replace(regex, '')
|
||||
value = value.replace(regex, toReplace || '')
|
||||
})
|
||||
return value
|
||||
}
|
||||
|
@ -152,7 +153,7 @@
|
|||
RemoveSpecialChars (value) {
|
||||
assert(value)
|
||||
|
||||
return this.RemoveStuff(value, ['&'])
|
||||
return this.RemoveStuff(value, specialChars, ' ')
|
||||
}
|
||||
|
||||
// if the value is empty, or whitespace
|
||||
|
@ -1296,7 +1297,9 @@
|
|||
|
||||
let count = 0
|
||||
r.forEach((item) => {
|
||||
if (item.match > minResultMatchPercent) { count++ }
|
||||
if (item.match > minResultMatchPercent) {
|
||||
count++
|
||||
}
|
||||
})
|
||||
|
||||
return count === 0 ? -1 : count
|
||||
|
@ -1392,12 +1395,12 @@
|
|||
var question = {} // the current question
|
||||
// QUESTION --------------------------------------------------------------------------------------------------------------------
|
||||
var q = RPM.GetQuestionFromResult(i)
|
||||
if (q !== undefined) { question.q = SUtils.SimplifyQuery(q) }
|
||||
if (q !== undefined) { question.q = SUtils.SimplifyQuestion(q) }
|
||||
|
||||
// RIGHTANSWER ---------------------------------------------------------------------------------------------------------------------
|
||||
var a = RPM.GetRightAnswerFromResultv2(i)
|
||||
if (a === undefined) { a = RPM.GetRightAnswerFromResult(i) }
|
||||
if (a !== undefined) { question.a = SUtils.SimplifyQuery(a) }
|
||||
if (a !== undefined) { question.a = SUtils.SimplifyAnswer(a) }
|
||||
// IMG ---------------------------------------------------------------------------------------------------------------------
|
||||
var img = GetImageFormResult(i)
|
||||
question.i = img
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue