Repository navigation
Conversation
…option
A choice or true/false key that resolves to no option or truth value
("Richtig, weil ...", an empty key) made exact matching fail the item and
overrule any judge verdict. Such items are now graded by the judge, like
open answers.
Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
MohammadHijjawi97
left a comment
There was a problem hiding this comment.
Thanks, this fills a real gap left by #2952. vitest run tests/quiz gives 37 passed, tsc --noEmit and eslint on the two files are clean, and the new test fails with QuizViewer.tsx reverted to dev.
One case seems off. hasObjectiveKey() is stricter than isAnswerCorrect(), so some keys that exact matching can read lose their authority. isAnswerCorrect() accepts the first letter of the key (correct.charAt(0)), so a key like "B) Paris" or "B. Paris" still marks B as correct. But resolveChoiceAnswerKey("B) Paris", options) returns "B) PARIS", which is not in options, so the item now counts as non-objective. A wrong pick then takes the judge's verdict.
I checked this with a temporary test next to yours: choiceQuestion with correct_answer: "B) Paris", the learner picks Madrid, and the judge returns correct. On this head updateNotebookEntry gets is_correct: true. On dev it gets is_correct: false. The backend normalizer leaves such keys as they are (_normalize_quiz_payload only maps an exact key or an exact label), so they can reach the viewer.
A simple fix is to make hasObjectiveKey() use the same resolution as isAnswerCorrect(). For example, also treat the item as objective when key.charAt(0).toUpperCase() is an option key, or move the key resolution into one helper that both functions call. Either way, "readable for a correct answer" and "authoritative for a wrong answer" would always match.
| const key = question.correct_answer.trim(); | ||
| if (!key) return false; | ||
| if (isMultipleChoice(question)) { | ||
| return resolveChoiceAnswerKey(key, question.options) in question.options!; |
There was a problem hiding this comment.
isAnswerCorrect() also accepts correct.charAt(0), so for a key like "B) Paris" exact matching marks B correct, but this returns false and a wrong pick can be flipped by the judge. Could this share the same resolution?
Description
Follow-up to the judge-verdict PR (#2952, merged). In a quiz, a choice or true/false item whose key resolves to no option or truth value (e.g. a key such as "Richtig, weil …", or an empty key) was failed by exact matching, and that exact-match result also overruled any AI-judge verdict, because choice and true/false items are treated as objective.
Such items are now left to the judge, like open answers: an item counts as objective only when its key names one of its options (choice) or a truth value (true/false). Items with a readable key are graded exactly as before.
Related Issues
getAssessmentrule that PR introduced.Module(s) Affected
web(Frontend)testsChecklist
dev(notmain— see the base-branch selector above).pre-commit run --all-filesand fixed any issues (ran tsc, eslint, vitest,npm run i18n:checkandnpm run contracts:checkindividually).Additional Notes
web/tests/quiz/QuizViewer.smoke.spec.tsx› "lets the judge grade a true/false item whose key names no truth value". It fails without the change (exact matching marks the judged-correct answer wrong) and passes with it.vitest run tests/quiz: 36 passed;tsc --noEmitclean.