New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix inconsistency between Pass Required and Passing Grade for answer feedback #7525
Conversation
Test the previous changes of this PR with WordPress Playground. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #7525 +/- ##
============================================
+ Coverage 51.57% 51.79% +0.22%
- Complexity 11235 11239 +4
============================================
Files 622 622
Lines 47518 47520 +2
Branches 414 414
============================================
+ Hits 24506 24613 +107
+ Misses 22679 22574 -105
Partials 333 333
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
@@ -923,7 +923,7 @@ public static function the_answer_feedback( $question_id ) { | |||
$quiz_graded = $user_quiz_progress && ! in_array( $user_quiz_progress->get_status(), array( 'ungraded', 'in-progress' ) ); | |||
|
|||
$quiz_required_pass_grade = intval( get_post_meta( $quiz_id, '_quiz_passmark', true ) ); | |||
$succeeded = $user_quiz_grade >= $quiz_required_pass_grade; | |||
$succeeded = ! Sensei_Quiz::is_pass_required( $lesson_id ) || $user_quiz_grade >= $quiz_required_pass_grade; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the editor UI, we hide the "Passing Grade" if the "Pass Required" is turned off. So the behavior in the frontend should be the same ("Passing Grade" shouldn't matter if "Pass Required" is turned off).
In this case, we are considering the quiz as succeeded if "Pass Required" is turned off for the answer feedback logic.
Test the previous changes of this PR with WordPress Playground. |
Test the previous changes of this PR with WordPress Playground. |
</div> | ||
<?php } ?> | ||
</div> | ||
<?php if ( $indicate_incorrect || $has_answer_notes || $correct_answer ) { ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only change here was this extra conditional to not display the wrapper when not needed. The rest is only indentation.
After 44e491c, I don't see any logic that would need this conditional, but I'll keep it only for safety given the logic of this method.
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. |
Test the previous changes of this PR with WordPress Playground. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as described! Thanks for fixing this.
Related with #7524
Proposed Changes
It's a little complicated to explain. So to understand the context, I'd like you to use
trunk
and create a new course with a quiz, following the normal flow (through the Course Outline) and only turning on the setting "Auto Grade" on the quiz. Add to the quiz a multiple choice question with an answer feedback.Answer the quiz as a student, and check that you will see the answer feedback. So I think we could consider it as the default behavior of a normal user, right?
The course creators could see different behaviors if they check the "Pass Required" setting, change the related settings, and turn it off.
The current behavior also has some issues like displaying the answer feedback wrapper and not displaying the content of it. See it when changing the passing grade to 100, unchecking the "Pass Required", and grading the quiz with wrong answers (not achieving the configured passing grade).
This PR fixes this inconsistency with the answers feedback by always displaying it if the "Pass Required" is turned off.
Cons: Users that changed the settings that are displayed when "Pass Required" is checked, and then turn it off again might see a behavior change depending on their settings.
For more context, see this:
sensei/includes/class-sensei-question.php
Lines 1122 to 1124 in 735df53
I suspect the pass required check was missed as part of this refactor: #4408
Testing Instructions
Pre-Merge Checklist