kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Practice quiz card shows a stale question count when the learner returns before the answer saves

Open rtibblesbot opened this issue 1 week ago • 0 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: release-v0.20.x

Observed behavior

A learner answers a question in a practice quiz, clicks Next, and returns to the lesson while that answer's save is still in flight. The quiz card counts the answer as unanswered and stays that way until the lesson is loaded again.

  • goToQuestion starts the save and does not wait for it.
  • showLessonPlaylist requests /api/content/contentnodeprogress/ once, as the route changes.
  • When the server answers that request before it stores the save, the response has num_question_answered: 0, and nothing requests the counts again.
  • On release-v0.20.x the card then reads "0 questions left". With the change for #15979 it reads "3 questions left".

Expected behavior

The card counts every answer the learner has saved.

User-facing consequences

The learner sees one more question left than they have. The count corrects itself the next time the lesson loads.

Steps to reproduce

In a Jest test that imports the real useProgressTracking and useContentNodeProgress and mocks kolibri/client:

  1. Call initContentSession for a 3-question practice quiz and resolve it with progress: 0 and no pastattempts.
  2. Call updateContentSession({ progress: 0.001, interaction }) with an interaction that has no id. The PUT goes out at once.
  3. Call fetchContentNodeProgress({ lesson }) and resolve it with progress: 0, num_question_answered: 0, total_questions: 3.
  4. Resolve the PUT.
  5. Read contentNodeProgressMetaDataMap for the quiz: num_question_answered is undefined on release-v0.20.x and 0 with the change for #15979.

Context

Acceptance Criteria

  • [ ] After answering Question 1 of a 3-question practice quiz, clicking Next and returning to the lesson before the save completes, the card reads "2 questions left" once the save completes, without a reload.
  • [ ] A Jest test resolves the lesson's progress response before the save's response, and fails on release-v0.20.x at 9bec30782b.
  • [ ] The pages listed under Context show the saved count in the same ordering.

AI usage

Claude Code found this while reviewing the change for #15979, reproduced the ordering in Jest and drafted this report.

rtibblesbot avatar Nov 25 '26 03:11 rtibblesbot