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', '' ); |
and as
null if there's no quiz attempt in class-llms-grades.php
but then comparing to
false to see if we need to re-calculate
|
$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' ) ) |
|
); |
|
|
|
} |
Reproduction Steps
Reporting)
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.phplifterlms/includes/models/model.llms.quiz.attempt.php
Line 249 in 3a04d99
nullif there's no quiz attempt in class-llms-grades.phplifterlms/includes/class-llms-grades.php
Line 140 in 3a04d99
falseto see if we need to re-calculatelifterlms/includes/class-llms-grades.php
Lines 219 to 233 in 3a04d99