kolibri
kolibri copied to clipboard
Add score in practice quiz
Summary
Now the ContentNodeProgressViewSet return num_attempts, num_correct_attempts and total_questions. Some frontend work remains
References
Fixes #8643
Reviewer guidance
How do I calculate the score and no of question in the frontend
Testing checklist
- [x] Contributor has fully tested the PR manually
- [ ] If there are any front-end changes, before/after screenshots are included
- [ ] Critical user journeys are covered by Gherkin stories
- [ ] Critical and brittle code paths are covered by unit tests
PR process
- [ ] PR has the correct target branch and milestone
- [x] PR has 'needs review' or 'work-in-progress' label
- [ ] If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
- [ ] If this is an important user-facing change, PR or related issue has a 'changelog' label
- [ ] If this includes an internal dependency change, a link to the diff is provided
Reviewer checklist
- PR is fully functional
- PR has been tested for accessibility regressions
- External dependency files were updated if necessary (
yarnandpip) - Documentation is updated
- Contributor is in AUTHORS.md
Build Artifacts
| Asset type | Download link |
|---|---|
| PEX file | kolibri-0.18.0.dev0_git.20240923062822.pex |
| Windows Installer (EXE) | kolibri-0.18.0.dev0+git.20240923062822-windows-setup-unsigned.exe |
| Debian Package | kolibri_0.18.0.dev0+git.20240923062822-0ubuntu1_all.deb |
| Mac Installer (DMG) | kolibri-0.18.0.dev0+git.20240923062822.dmg |
| Android Package (APK) | kolibri-0.18.0.dev0+git.20240923062822-0.1.4-debug.apk |
| TAR file | kolibri-0.18.0.dev0+git.20240923062822.tar.gz |
| WHL file | kolibri-0.18.0.dev0+git.20240923062822-py2.py3-none-any.whl |
Hey @thesujai, thanks! Regarding frontend parts,
How do I calculate the score and no of question in the frontend
Was this a question for us? If so, we have some score calculations here
https://github.com/learningequality/kolibri/blob/develop/kolibri/plugins/learn/assets/src/views/cards/QuizCard/index.vue#L59-L87
That said, I'm not entirely sure what cards exactly you will need work on. Please send me a link to the card component that's used for a practice quiz.
Also there's some guidance in comments from @rtibbles in the issue's comments https://github.com/learningequality/kolibri/issues/8643, and some touch on frontend parts as well.
HI @MisRob
The issue was that we could keep attempting a practice quiz even after all questions were complete(Not a bug). But this means that a new attempt_log will be created for every new attempt. So a point can be reached where num_correct_attempts>num_questions. We cannot calculate score in this case.
I discussed this with @nucleogenesis and he suggested fetching all of the attemptlogs which are correct, but unique by AttemptLog.item. So I am working on that approach
Okay, it sounds you've got all you need then
Concern: When a quiz has more questions than the minimum required to complete it (e.g., a quiz has 20 questions, but only 6 need to be correct to mark it as complete), the progress shows as 1 (100%) after answering the required number of questions. However, if the score is calculated using the total number of questions (num_correct_attempts/num_questions), it may appear low even when the quiz is marked as complete, which could be confusing.
One approach could be to calculate num_questions and num_correct_attempts based on the criteria for completing the quiz. For instance, if a quiz is marked complete after 6 correct answers, then:
num_questionswould be set to 6 (the number required for completion).num_correct_attemptswould be calculated up to that point, ensuring the score reflects only those necessary attempts.
This way, the score and progress would be more aligned, avoiding confusion when the progress is 1 but the score seems low.
@thesujai I am looping in @nucleogenesis here, since you mentioned you've already had some discussions regarding this together
@thesujai after a quick chat w/ Richard I think I see the misunderstanding on my end.
A "Practice Quiz" will not allow multiple attempts at the same question within the same "Quiz Attempt" -- that is to say, when you take a "Practice Quiz" it is treated like a "Quiz" in that you're going straight through it.
Which means:
- Mastery model can be ignored
- % is a calculation of num_correct_attempts / total_questions because the user is expected to have attempted all of the questions exactly one time
So if you only get the data for the last "AttemptLog" for the practice quiz, then you should have the correct data there.
I'll give the code another look through w/ this in mind
I understand why the linting failed here, but not why locally it passed
Codewise, this is good to go - this just needs QA sign off to merge.
Hi @rtibbles and @thesujai besides the issue already noted in https://github.com/learningequality/kolibri/issues/12663 I was able to identify only one more which is that the 'Score N%' text is not translated in the other supported languages:
As this is new string here, I think this is to be expected!