From: skodak <skodak>
Date: Mon, 25 Feb 2008 12:17:46 +0000 (+0000)
Subject: MDL-13653 droplow not ignoring ungraded items un sum aggregation; merged from MOODLE_... 
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d28f25a49398409a11c1059a5badfb3a3cc8cd37;p=moodle.git

MDL-13653 droplow not ignoring ungraded items un sum aggregation; merged from MOODLE_19_STABLE
---

diff --git a/lib/grade/grade_category.php b/lib/grade/grade_category.php
index dc707f613b..e8d7a36095 100644
--- a/lib/grade/grade_category.php
+++ b/lib/grade/grade_category.php
@@ -684,6 +684,15 @@ class grade_category extends grade_object {
             }
         }
 
+        // use 0 if grade missing, droplow used and aggregating all items
+        if (!$this->aggregateonlygraded and !empty($this->droplow)) {
+            foreach($items as $itemid=>$value) {
+                if (!isset($grade_values[$itemid]) and !in_array($itemid, $excluded)) {
+                    $grade_values[$itemid] = 0;
+                }
+            }
+        }
+
         $max = 0;
 
         //find max grade