From: skodak Date: Mon, 10 Mar 2008 21:18:16 +0000 (+0000) Subject: MDL-13866 fixed stupid bug in my last commit; merged from MOODLE_19_STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a7e51d62f3a7f0ee13030d3a954a17a6e7897601;p=moodle.git MDL-13866 fixed stupid bug in my last commit; merged from MOODLE_19_STABLE --- diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 17cba23bbe..e98c8366f1 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1211,15 +1211,18 @@ function forum_get_user_grades($forum, $userid=0) { // 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 $rid=>$result) { if ($forum->scale >= 0) { - //numberic + //numeric if ($result->rawgrade > $forum->scale) { $results[$rid]->rawgrade = $forum->scale; } } else { //scales - $max = count_records('scale', 'id', - $forum->scale); - if ($result->rawgrade > $max) { - $results[$rid]->rawgrade = $max; + if ($scale = get_record('scale', 'id', -$forum->scale)) { + $scale = explode(',', $scale->scale); + $max = count($scale); + if ($result->rawgrade > $max) { + $results[$rid]->rawgrade = $max; + } } } }