sensei
sensei copied to clipboard
Fix timed quiz still working for students even after time ends
Resolves https://github.com/Automattic/sensei-pro/issues/2606
Proposed Changes
In timed quizzes, when time is up, the frontend code clicks the completion button to submit the quiz. But in the cases where the quiz was paginated, completion button only got rendered on the last page. So if the student was not on the last page, the quiz didn't get submitted, and the student was still able to answer.
To fix that, we're rendering the button even in the middle pages so that the completion function still works, but keeping it hidden in those cases so that UI doesn't break or change from before.
Testing Instructions
- Create a Course with a lesson that has a quiz with many questions
- Make sure you have Sensei Pro enabled
- From the quiz settings, set pagination to
Multi Pageand setper pagevalue to 1 or a small number to generate many pages - Also enable
Quiz Timeroption, set a small time - Now take the quiz as a student, be on any page other than the last page
- Make sure when time is up, the quiz gets submitted
- Now take the quiz as another student, finish the quiz normally and make sure it works
- Now take the quiz as a student for the third time, stay on the last page of the quiz without submitting, make sure the quiz gets submitted automatically when the time is up.
Pre-Merge Checklist
- [x] PR title and description contain sufficient detail and accurately describe the changes
- [x] Acceptance criteria is met
- [x] Decisions are publicly documented
- [x] Adheres to coding standards (PHP, JavaScript, CSS, HTML)
- [ ] All strings are translatable (without concatenation, handles plurals)
- [x] Follows our naming conventions (P6rkRX-4oA-p2)
- [ ] Hooks (p6rkRX-1uS-p2) and functions are documented
- [ ] New UIs are responsive and use a mobile-first approach
- [ ] New UIs match the designs
- [ ] Different user privileges (admin, teacher, subscriber) are tested as appropriate
- [ ] Legacy courses (course without blocks) are tested
- [ ] Code is tested on the minimum supported PHP and WordPress versions
- [ ] User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
- [ ] "Needs Documentation" label is added if this change requires updates to documentation
- [ ] Known issues are created as new GitHub issues
Test the previous changes of this PR with WordPress Playground.
Test the previous changes of this PR with WordPress Playground.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 52.37%. Comparing base (
f13414e) to head (1708578). Report is 110 commits behind head on trunk.
Additional details and impacted files
@@ Coverage Diff @@
## trunk #7675 +/- ##
============================================
+ Coverage 51.92% 52.37% +0.44%
- Complexity 11449 11463 +14
============================================
Files 651 653 +2
Lines 48659 48761 +102
Branches 468 480 +12
============================================
+ Hits 25268 25537 +269
+ Misses 23012 22835 -177
- Partials 379 389 +10
see 9 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
Legend - Click here to learn more
Ξ = absolute <relative> (impact),ΓΈ = not affected,? = missing dataPowered by Codecov. Last update ca19e19...1708578. Read the comment docs.
Test the previous changes of this PR with WordPress Playground.
Test the previous changes of this PR with WordPress Playground.
Test the previous changes of this PR with WordPress Playground.
@Imran92 Can you please address the feedback in this one? ππ»ββοΈ
Test the previous changes of this PR with WordPress Playground.
WordPress Dependencies Report
The github-action-wordpress-dependencies-report action has detected some script changes between the commit b54aec37315242076ff038c00a03e0fe1087e26d and trunk. Please review and confirm the following are correct before merging.
| Script Handle | Added Dependencies | Removed Dependencies | Total Size | Size Diff |
|---|---|---|---|---|
blocks/quiz/style.js |
wp-polyfill |
24 B | +24 B ( +100% πΌ ) |
This comment was automatically generated by the github-action-wordpress-dependencies-report action.
Test the previous changes of this PR with WordPress Playground.
Test the previous changes of this PR with WordPress Playground.
@Imran92 Can you please address the feedback in this one? ππ»ββοΈ
Thanks Donna! I've updated it here https://github.com/Automattic/sensei/pull/7675#discussion_r1821990573
Test the previous changes of this PR with WordPress Playground.