]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19407 Defaulting all grade items to non-extra-credit when moving to a SWM categor...
authornicolasconnault <nicolasconnault>
Thu, 17 Sep 2009 07:16:51 +0000 (07:16 +0000)
committernicolasconnault <nicolasconnault>
Thu, 17 Sep 2009 07:16:51 +0000 (07:16 +0000)
lib/grade/grade_item.php

index a67b112a4460ff66530801df9f9cf3db5e44e5f5..62b752bd3c5769963737d9ee6ad5c8080a3f70a8 100644 (file)
@@ -1221,6 +1221,13 @@ class grade_item extends grade_object {
             return false;
         }
 
+        // MDL-19407 If moving from a non-SWM category to a SWM category, convert aggregationcoef to 0
+        $currentparent = $this->load_parent_category();
+
+        if ($currentparent->aggregation != GRADE_AGGREGATE_WEIGHTED_MEAN2 && $parent_category->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN2) {
+            $this->aggregationcoef = 0;
+        }
+
         $this->force_regrading();
 
         // set new parent