Practice quiz card shows a stale question count when the learner returns before the answer saves
❌ 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.
goToQuestionstarts the save and does not wait for it.showLessonPlaylistrequests/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:
- Call
initContentSessionfor a 3-question practice quiz and resolve it withprogress: 0and nopastattempts. - Call
updateContentSession({ progress: 0.001, interaction })with aninteractionthat has noid. ThePUTgoes out at once. - Call
fetchContentNodeProgress({ lesson })and resolve it withprogress: 0,num_question_answered: 0,total_questions: 3. - Resolve the
PUT. - Read
contentNodeProgressMetaDataMapfor the quiz:num_question_answeredisundefinedon release-v0.20.x and0with the change for #15979.
Context
- Kolibri release-v0.20.x at 9bec30782b.
- These also request
contentnodeprogressonce on entry, while a save from the page the learner just left can be in flight:
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.