From 9855cf80a10ef16b20db09121f678e116de2475c Mon Sep 17 00:00:00 2001 From: "Mr. Angular" <5961291-MrAngular@users.noreply.gitlab.com> Date: Sun, 10 May 2020 23:28:34 +0000 Subject: [PATCH] fix(result): Fix simple when no answer --- stable.user.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/stable.user.js b/stable.user.js index 1a8db6f..df6fe22 100755 --- a/stable.user.js +++ b/stable.user.js @@ -580,12 +580,12 @@ GuessCorrectIn2LengthAnswersByPoints (i, items) { const first = { elem: items[0], - val: parseInt(items[0].childNodes[0].value), + val: items[0].childNodes[0].checked, text: items[0].innerText } const second = { elem: items[1], - val: parseInt(items[1].childNodes[0].value), + val: items[1].childNodes[0].checked, text: items[1].innerText } @@ -593,19 +593,21 @@ const grades = grade.split(' ').reduce((acc, text) => { if (text.includes(',')) { // FIXME: fancy regexp acc.push(parseInt(text)) + } else if (text.includes('.')) { // FIXME: fancy regexp + acc.push(parseInt(text)) } return acc }, []) if (grades[0] === 1) { - if (first.val === 1) { + if (first.val) { return first.text } else { return second.text } } else { - if (first.val === 0) { - return first.txt + if (!first.val) { + return first.text } else { return second.text }