mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
test result page parsing get solution if incorrect fix
This commit is contained in:
parent
de768fb281
commit
966a4093a4
1 changed files with 7 additions and 2 deletions
|
@ -353,10 +353,9 @@
|
|||
)
|
||||
},
|
||||
getterFunction: node => {
|
||||
const gradeText = node.getElementsByClassName('grade')[0].innerText
|
||||
const possibleAnswers = getPossibleAnswers(node)
|
||||
|
||||
if (gradeText.includes('0,00')) {
|
||||
if (getIfSolutionIsCorrect(node)) {
|
||||
if (possibleAnswers.length === 2) {
|
||||
return [
|
||||
{
|
||||
|
@ -381,6 +380,12 @@
|
|||
},
|
||||
}
|
||||
|
||||
function getIfSolutionIsCorrect(node) {
|
||||
const gradeText = node.getElementsByClassName('grade')[0].innerText
|
||||
const stateText = node.getElementsByClassName('state')[0].innerText
|
||||
return stateText.includes('Helyes') || !gradeText.includes('0,00')
|
||||
}
|
||||
|
||||
function getPossibleAnswers(node) {
|
||||
const answerNodes = Array.from(
|
||||
node.getElementsByClassName('answer')[0].childNodes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue