QTI order question counts as answered as soon as a learner opens it
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: develop
Observed behavior
In a quiz, opening a QTI order question (qti-order-interaction) marks it as answered, even if the learner never moves anything. The footer shows "1 of 2 questions answered" straight away. When the learner moves on to the next question, the order that was on screen is saved as their answer.
Here the learner opens a two-question quiz whose first question is an order question and doesn't touch it:
https://github.com/user-attachments/assets/b6b31a98-ff86-4fcf-800d-8f54f1e75a39
The saved attempt has answer.responses.RESPONSE = ["DriverA", "DriverB", "DriverC"] (the order as displayed) and correct: 0, although the learner never answered.
Cause
OrderInteraction.vue (L107–120) has an immediate watch that writes the displayed order into the response variable when it doesn't hold a valid order yet:
variable.value = deriveInitialOrder();
The QTIVariable setter calls its value-set callback (utils/qti/variables.js L171–174). For response variables that is onResponseValueChange in composables/useDeclarations.js, which fires onValueChange. AssessmentItem passes the viewer's interaction handler as onValueChange, so QTIViewer emits interaction while the item is still mounting.
The learner pages treat interaction as "the learner answered". For example, ExamPage interactionHandler sets currentQuestionAnswered = true, and saveAnswer then stores the attempt when the learner navigates away.
A Jest check in OrderInteraction.spec.js using the existing renderAssessmentItem helper shows it. Rendering q15-order-example-2 with no user action already calls interactionFn.
Expected behavior
Showing the initial order is not a learner interaction. The question should count as answered (and be saved) only after the learner reorders something, as with the other interaction types.
User-facing consequences
- The quiz footer and the submit dialog count untouched order questions as answered. A learner who skipped one isn't warned before submitting.
- An attempt is saved for a question the learner never answered, so the coach's report shows a wrong answer instead of "not answered".
- If the displayed order happens to be the correct one (for example with shuffling), the learner gets credit without answering.
Steps to reproduce
- Have a QTI exercise that includes an order question. I used Kolibri's own
q15-order-example-3fixture item, added to a local QTI exercise. - As a coach, create a quiz with that order question plus one other question, assign it to a class, and start it.
- Sign in as a learner in the class and open the quiz.
- Without touching anything on the order question, look at the footer: it says "1 of 2 questions answered".
- Click Next. An
AttemptLogis saved for the order question with the displayed order as the answer.
Possible fix
I'd be glad to work on this once the approach is agreed. One option is to set the initial order without firing the value-set callback, the same way QTIVariable.reset() writes a value silently. That keeps the visible order as the response for scoring, but doesn't signal an interaction. Only a real reorder (handleSort / moveItem) would mark the question answered.
With that change applied locally, the untouched question isn't counted or saved, and moving an item counts it as answered:
https://github.com/user-attachments/assets/09a6f7b7-538b-4bee-aa52-1163bd8c6b3f
Another option is to leave the response empty until the learner first reorders. That would also make the untouched question score as unanswered. Whether a learner should be able to submit the initial order as-is is a product decision.
Context
- Kolibri
develop(the QTI viewer files are unchanged between 07e85c89ef and 758605b764), dev server - macOS 26, Chromium
- Related: #14882 (order interaction viewer)
AI usage
I used an AI coding assistant to trace how the order interaction initializes its response and how the interaction event reaches the quiz page, to write a Jest check, and to draft this issue. I reproduced it in a local quiz, checked the saved attempt, and recorded the videos.
🔍 Thanks for opening this issue! @rtibblesbot will check it against the code and comment with its findings.
What happens next:
- The
community-issue-reviewlabel stays on until the review comment is posted. - The comment identifies the files, lines, or commits examined so you can follow the reasoning and respond if you disagree.
- If the check confirms the issue, @rtibblesbot may also correct the title and description. GitHub preserves the edit history, so the original text remains available.
- @rtibblesbot's comments are LLM-generated, so please evaluate them critically.
A maintainer decides what happens next. This check does not close the issue.
Verdict: claim holds
Evidence: kolibri/plugins/qti_viewer/frontend/components/interactions/OrderInteraction.vue:107-120 on develop at 758605b764
Checked by reading the code. I didn't run the Jest probe: this worktree has no node_modules.
OrderInteraction.vue:109-120: an immediatewatchsetsvariable.value = deriveInitialOrder()when the response doesn't hold a valid order.utils/qti/variables.js:171-174: thevaluesetter always calls_valueSetCallback().reset()(L177-179) doesn't call it.composables/useDeclarations.js:71-76: for response variables that callback isonResponseValueChange, which callsonValueChange.AssessmentItem.vue:124-126passes the injectedinteractionhandler asonValueChange.QTIViewer.vue:239emitsinteractionfrom it.AssessmentItem.vuesetFromAnswerState()callsvariable.reset()when there's no saved response, so the order variable starts with no valid order and the watch writes it.QTIViewerloads the item asynchronously, soExamPage's$refs.contentVieweralready exists when the item mounts.learn/.../ExamPage/index.vue:639-644:interactionHandlersetscurrentQuestionAnswered = truewhenevercheckAnswer()returns a value. The registered QTIcheckAnsweralways returns one.ExamPage/index.vue:510counts the question as answered inquestionsAnswered.saveAnswer(L645-664) then saves the displayed order as the attempt.
No duplicate found. #14882 tracks the order interaction as a whole and doesn't report this.
Written by rtibblesbot, an LLM-based coding agent.