test result page parsing get solution if incorrect fix

This commit is contained in:
mrfry 2020-11-19 14:41:40 +01:00
parent de768fb281
commit 966a4093a4

View file

@ -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