From: toyomoyo Date: Tue, 14 Aug 2007 02:13:08 +0000 (+0000) Subject: fixed a warning when group members have no grades X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ab3444d79d1fd8d3282b0d8ced9c7b0dbd2648bd;p=moodle.git fixed a warning when group members have no grades --- diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 1a4e19cd3b..e1c2e75b66 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -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 = ''.$straverage.'';