Skip to content

Commit

Permalink
MDL-41446 Completion: Incorrectly marks complete when grade data pres…
Browse files Browse the repository at this point in the history
…ent with no actual grade
  • Loading branch information
sammarshallou committed Sep 6, 2013
1 parent b69ec28 commit 1f8662f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/completionlib.php
Expand Up @@ -1277,9 +1277,12 @@ public function inform_grade_changed($cm, $item, $grade, $deleted) {
* @return int Completion state e.g. COMPLETION_INCOMPLETE
*/
public static function internal_get_grade_state($item, $grade) {
if (!$grade) {
// If no grade is supplied or the grade doesn't have an actual value, then
// this is not complete.
if (!$grade || (is_null($grade->finalgrade) && is_null($grade->rawgrade))) {
return COMPLETION_INCOMPLETE;
}

// Conditions to show pass/fail:
// a) Grade has pass mark (default is 0.00000 which is boolean true so be careful)
// b) Grade is visible (neither hidden nor hidden-until)
Expand Down

0 comments on commit 1f8662f

Please sign in to comment.