MDL-38559 Fix the ability to disable the grade condition in the course completion...
authorDavid Mudrák <david@moodle.com>
Thu, 9 May 2013 15:49:53 +0000 (17:49 +0200)
committerDavid Mudrák <david@moodle.com>
Thu, 9 May 2013 21:24:49 +0000 (23:24 +0200)
completion/criteria/completion_criteria_grade.php

index 3836e0c..2e9655f 100644 (file)
@@ -80,12 +80,14 @@ class completion_criteria_grade extends completion_criteria {
      */
     public function update_config(&$data) {
 
-        $formatedgrade = unformat_float($data->criteria_grade_value);
-        // TODO validation
-        if (!empty($formatedgrade) && is_numeric($formatedgrade)) {
-            $this->course = $data->id;
-            $this->gradepass = $formatedgrade;
-            $this->insert();
+        if (!empty($data->criteria_grade)) {
+            $formatedgrade = unformat_float($data->criteria_grade_value);
+            // TODO validation
+            if (!empty($formatedgrade) && is_numeric($formatedgrade)) {
+                $this->course = $data->id;
+                $this->gradepass = $formatedgrade;
+                $this->insert();
+            }
         }
     }