-
Notifications
You must be signed in to change notification settings - Fork 139
Saving of cached values for grades doesn't match cache miss check #3116
Copy link
Copy link
Open
Description
Reproduction Steps
- Install and activate Redis Object Cache plugin (or any persistent object cache)
- Enroll a student in a course that has a lesson with a quiz assigned
- Complete the quiz as the student (score does not matter, e.g. 90%)
- Navigate to the student's grades view (My Grades, Admin Reporting, or Group
Reporting) - Observe: Overall Grade shows 0%, lesson Grade column shows a dash
- Verify in wp_lifterlms_quiz_attempts that the quiz attempt exists with the correct grade
and status='pass'
Expected Behavior
Overall Grade displays 90%, lesson Grade column displays 90%.
Actual Behavior
Overall Grade displays 0%, lesson Grade column displays N/A (dash).
Full report on HS-272958
Tech Notes
We are saving the overall grade as '' (empty string) in model.llms.quiz.attempt.php
| $this->get_student()->set( 'overall_grade', '' ); |
null if there's no quiz attempt in class-llms-grades.php lifterlms/includes/class-llms-grades.php
Line 140 in 3a04d99
| $grade = null; |
false to see if we need to re-calculate lifterlms/includes/class-llms-grades.php
Lines 219 to 233 in 3a04d99
| $grade = $use_cache ? $this->get_grade_from_cache( $post, $student ) : false; | |
| // Grade not found in cache or we're not using the cache. | |
| if ( false === $grade ) { | |
| $grade = $this->calculate_grade( $post, $student ); | |
| // Store in the cache. | |
| wp_cache_set( | |
| sprintf( '%d_grade', $post->get( 'id' ) ), | |
| $grade, | |
| sprintf( 'student_%d', $student->get( 'id' ) ) | |
| ); | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Review in Progress