kolibri
kolibri copied to clipboard
Changing a saved quiz answer records the wrong time spent
❌ 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
saveAnswercomputestime_spentas((this.currentAttempt.time_spent || 0) + Date.now() - this.startTime) / 1000.currentAttempt.time_spentis the saved value in seconds;Date.now() - this.startTimeis milliseconds. The sum is divided by 1000 as a whole.- The server stores the value as sent: https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/core/logger/viewsets/progress_tracking.py#L758
- Sites:
- https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/views/ExamPage/index.vue#L659
- https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/views/QuizRenderer/index.vue#L434
- https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/views/courses/QuizRenderer/index.vue#L379
- https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/views/courses/PrePostTestRenderer/index.vue#L415
Expected behavior
- The time spent on a question is the total across every visit to it, in seconds.
Steps to reproduce
- Answer a quiz question after 60 seconds and press Next. The PUT sends
time_spent: 60. - Press Previous, wait 5 seconds, change the answer and press Next.
- The PUT sends
time_spent: 5.06, not65.
Context
- develop at
758605b764. - #15980 changes the same four components and their specs, and creates
ExamPage.spec.js.
Acceptance Criteria
- [ ] In class quizzes, practice quizzes, surveys, course quizzes and course pre/post tests, a changed answer sends the earlier
time_spentplus the seconds since the question was opened. - [ ] Specs cover a changed answer in each of the four components.
AI usage
Claude Code found this while working on #15980 and drafted the issue; rtibbles kept #15980 to focus handling.