]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13866 fixed stupid bug in my last commit; merged from MOODLE_19_STABLE
authorskodak <skodak>
Mon, 10 Mar 2008 21:18:16 +0000 (21:18 +0000)
committerskodak <skodak>
Mon, 10 Mar 2008 21:18:16 +0000 (21:18 +0000)
mod/forum/lib.php

index 17cba23bbe24dab0d82b11e84ae0902bebbf56be..e98c8366f1bcf40f0ef6a338a42174b31f5ae7f4 100644 (file)
@@ -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;
+                    }
                 }
             }
         }