]> git.mjollnir.org Git - moodle.git/commitdiff
fixed a warning when group members have no grades
authortoyomoyo <toyomoyo>
Tue, 14 Aug 2007 02:13:08 +0000 (02:13 +0000)
committertoyomoyo <toyomoyo>
Tue, 14 Aug 2007 02:13:08 +0000 (02:13 +0000)
grade/report/grader/lib.php

index 1a4e19cd3b336294e3bff4fb950d3aaae51a5cfa..e1c2e75b665db7c2a80ae2ea0b65d76f6dac7a3c 100644 (file)
@@ -807,13 +807,14 @@ class grade_report_grader extends grade_report {
 
             $sum_array = array();
             $count_array = array();
-            $sums = get_records_sql($SQL);
-            foreach ($sums as $itemid => $csum) {
-                $sum_array[$itemid] = $csum->sum;
-                if ($totalcount) {
-                    $count_array[$itemid] = $totalcount;
-                } else {
-                    $count_array[$itemid] = $csum->count;
+            if ($sums = get_records_sql($SQL)) {
+                foreach ($sums as $itemid => $csum) {
+                    $sum_array[$itemid] = $csum->sum;
+                    if ($totalcount) {
+                        $count_array[$itemid] = $totalcount;
+                    } else {
+                        $count_array[$itemid] = $csum->count;
+                    }
                 }
             }
             $avghtml = '<tr><th>'.$straverage.'</th>';