Permalink
Browse files

lesson MDL-26768 lesson was inserting a grade of 0 when a user id and…

… a null raw grade were supplied
  • Loading branch information...
1 parent 2b37004 commit 76027a9f65ea73c49b5cfda4ff3be998af6a8441 @andyjdavis andyjdavis committed Mar 14, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 mod/lesson/lib.php
View
@@ -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;
+ }
}
}

0 comments on commit 76027a9

Please sign in to comment.