Permalink
Browse files

MDL-43020: Fix calculation of lesson scale value warning

  • Loading branch information...
1 parent 7b52944 commit 20d1fea57ff0819fb32b3db05088c3d2ea59d63b @tlock tlock committed Nov 24, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 mod/lesson/lib.php
View
6 mod/lesson/lib.php
@@ -470,8 +470,10 @@ function lesson_grade_item_update($lesson, $grades=null) {
$params['scaleid'] = -$lesson->grade;
// When converting a score to a scale, use scale's grade maximum to calculate it.
- $grade = grade_get_grades($lesson->course, 'mod', 'lesson', $lesson->id, reset($grades)->userid);
- $params['grademax'] = reset($grade->items)->grademax;
+ if (!empty($grades)) {
+ $grade = grade_get_grades($lesson->course, 'mod', 'lesson', $lesson->id, reset($grades)->userid);
+ $params['grademax'] = reset($grade->items)->grademax;
+ }
} else {
$params['gradetype'] = GRADE_TYPE_NONE;
}

0 comments on commit 20d1fea

Please sign in to comment.