lesson MDL-26768 lesson was inserting a grade of 0 when a user id and a null raw grade were supplied
This commit is contained in:
+7
-1
@@ -487,7 +487,13 @@ function lesson_grade_item_update($lesson, $grades=NULL) {
|
||||
if (!is_array($grade)) {
|
||||
$grades[$key] = $grade = (array) $grade;
|
||||
}
|
||||
$grades[$key]['rawgrade'] = ($grade['rawgrade'] * $lesson->grade / 100);
|
||||
//check raw grade isnt null otherwise we erroneously insert a grade of 0
|
||||
if ($grade['rawgrade'] !== null) {
|
||||
$grades[$key]['rawgrade'] = ($grade['rawgrade'] * $lesson->grade / 100);
|
||||
} else {
|
||||
//setting rawgrade to null just in case user is deleting a grade
|
||||
$grades[$key]['rawgrade'] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user