kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

QTI order question counts as answered as soon as a learner opens it

Open Rishika-dev opened this issue 1 week ago • 2 comments

❌ 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

  1. Have a QTI exercise that includes an order question. I used Kolibri's own q15-order-example-3 fixture item, added to a local QTI exercise.
  2. As a coach, create a quiz with that order question plus one other question, assign it to a class, and start it.
  3. Sign in as a learner in the class and open the quiz.
  4. Without touching anything on the order question, look at the footer: it says "1 of 2 questions answered".
  5. Click Next. An AttemptLog is 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.

Rishika-dev avatar Nov 27 '26 11:11 Rishika-dev

🔍 Thanks for opening this issue! @rtibblesbot will check it against the code and comment with its findings.

What happens next:

  • The community-issue-review label 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.

learning-equality-bot avatar Nov 27 '26 11:11 learning-equality-bot

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 immediate watch sets variable.value = deriveInitialOrder() when the response doesn't hold a valid order.
  • utils/qti/variables.js:171-174: the value setter always calls _valueSetCallback(). reset() (L177-179) doesn't call it.
  • composables/useDeclarations.js:71-76: for response variables that callback is onResponseValueChange, which calls onValueChange.
  • AssessmentItem.vue:124-126 passes the injected interaction handler as onValueChange. QTIViewer.vue:239 emits interaction from it.
  • AssessmentItem.vue setFromAnswerState() calls variable.reset() when there's no saved response, so the order variable starts with no valid order and the watch writes it.
  • QTIViewer loads the item asynchronously, so ExamPage's $refs.contentViewer already exists when the item mounts.
  • learn/.../ExamPage/index.vue:639-644: interactionHandler sets currentQuestionAnswered = true whenever checkAnswer() returns a value. The registered QTI checkAnswer always returns one.
  • ExamPage/index.vue:510 counts the question as answered in questionsAnswered. 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.

rtibblesbot avatar Nov 27 '26 12:11 rtibblesbot