From df17e1bd9345bee04e6fc40265b2f1bddc883fe8 Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 5 Feb 2008 11:49:39 +0000 Subject: [PATCH] MDL-3942 fixed warnings; merged from MOODEL_19_STABLE --- mod/forum/lib.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 1793902b74..22bd0beee9 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1228,15 +1228,17 @@ function forum_get_user_grades($forum, $userid=0) { break; } - $results = get_records_sql($sql); - // it could throw off the grading if count and sum returned a rawgrade higher than scale - // so to prevent it we review the results and ensure that rawgrade does not exceed the scale, if it does we set rawgrade = scale (i.e. full credit) - foreach ($results as $result) { - if ($result->rawgrade >$forum->scale) { - $result->rawgrade = $forum->scale; + if ($results = get_records_sql($sql)) { + // it could throw off the grading if count and sum returned a rawgrade higher than scale + // so to prevent it we review the results and ensure that rawgrade does not exceed the scale, if it does we set rawgrade = scale (i.e. full credit) + foreach ($results as $result) { + if ($result->rawgrade > $forum->scale) { + $result->rawgrade = $forum->scale; + } } } - return $results; + + return $results; } /** -- 2.39.5