kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Learner quiz stays on the loader when the link's question index is negative, fractional or not a number

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: develop

Observed behavior

  • showExam reads the index with Number(params.questionNumber) and rejects it only when it is >= the question count: https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/modules/examViewer/handlers.js#L13 and https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/modules/examViewer/handlers.js#L65
  • -1, 0.5 and abc pass that check and are committed to the store.
  • ExamPage finds no question at that index and renders KCircularLoader with no error: https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/views/ExamPage/index.vue#L8

Expected behavior

  • An index that names no question shows the same error as one past the end of the quiz: Question number … is not valid for this quiz.

Steps to reproduce

  1. As a learner, open a quiz from Learn > Home.
  2. Replace the last URL segment with -1, 0.5 or abc and reload.
  3. The loader never ends.

Context

  • develop at 758605b764.
  • Route: /classes/:classId/exam/:examId/:questionNumber.
  • #15987 changes the same showExam promise chain; #15980 creates ExamPage.spec.js.

Acceptance Criteria

  • [ ] Opening a quiz with index -1, 0.5 or abc ends loading and shows the invalid-question error.
  • [ ] Opening a quiz with an in-range integer index, including 0, opens that question as on develop.
  • [ ] ExamPage.spec.js covers each index above through the route handler.

AI usage

Claude Code found this while working on #15980 and drafted the issue; rtibbles kept #15980 to focus handling.

rtibblesbot avatar Nov 25 '26 07:11 rtibblesbot