Merge branch 'MDL-52275_master' of git://github.com/markn86/moodle
authorDan Poltawski <dan@moodle.com>
Tue, 29 Dec 2015 10:04:42 +0000 (10:04 +0000)
committerDan Poltawski <dan@moodle.com>
Tue, 29 Dec 2015 10:04:42 +0000 (10:04 +0000)
course/modedit.php

index 4b9edaf..65880f9 100644 (file)
@@ -187,15 +187,14 @@ if (!empty($add)) {
 
     if ($items = grade_item::fetch_all(array('itemtype'=>'mod', 'itemmodule'=>$data->modulename,
                                              'iteminstance'=>$data->instance, 'courseid'=>$course->id))) {
-        // add existing outcomes
+        // Add existing outcomes.
         foreach ($items as $item) {
-            if (!empty($item->gradepass)) {
+            if (!empty($item->outcomeid)) {
+                $data->{'outcome_' . $item->outcomeid} = 1;
+            } else if (!empty($item->gradepass)) {
                 $decimalpoints = $item->get_decimals();
                 $data->gradepass = format_float($item->gradepass, $decimalpoints);
             }
-            if (!empty($item->outcomeid)) {
-                $data->{'outcome_'.$item->outcomeid} = 1;
-            }
         }
 
         // set category if present