From ab3444d79d1fd8d3282b0d8ced9c7b0dbd2648bd Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Tue, 14 Aug 2007 02:13:08 +0000 Subject: [PATCH] fixed a warning when group members have no grades --- grade/report/grader/lib.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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.''; -- 2.39.5