]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-3942 fixed warnings; merged from MOODEL_19_STABLE
authorskodak <skodak>
Tue, 5 Feb 2008 11:49:39 +0000 (11:49 +0000)
committerskodak <skodak>
Tue, 5 Feb 2008 11:49:39 +0000 (11:49 +0000)
mod/forum/lib.php

index 1793902b742b34c3469087fb350f8a51a12cc0bb..22bd0beee902211fe60acd74f4fe329144f7cc7d 100644 (file)
@@ -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;
 }
 
 /**