Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-43020: Fix calculation of lesson scale value warning

  • Loading branch information...
commit 7a2b15647eb8da241840164d283ac8d579ef514e 1 parent ab077b3
@tlock tlock authored
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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.