Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix in forum_grades

  • Loading branch information...
commit 36df40d60eaabee0ba9ff7c52bead3ab70284670 1 parent 4db9d14
moodler authored

Showing 1 changed file with 13 additions and 11 deletions. Show diff stats Hide diff stats

  1. +13 11 mod/forum/lib.php
24 mod/forum/lib.php
@@ -372,18 +372,20 @@ function forum_grades($forumid) {
372 372 if (!$forum->assessed) {
373 373 return false;
374 374 }
375   - if ($ratings = get_records_sql_menu("SELECT p.user, r.rating
376   - FROM forum_discussions d, forum_posts p, forum_ratings r
377   - WHERE d.forum = '$forumid'
378   - AND p.discussion = d.id
379   - AND r.post = p.id")) {
380   - foreach ($ratings as $user => $rating) {
381   - if (!isset($sumrating[$user])) {
382   - $sumrating[$user][1] = 0;
383   - $sumrating[$user][2] = 0;
384   - $sumrating[$user][3] = 0;
  375 + if ($ratings = get_records_sql("SELECT p.user, r.rating
  376 + FROM forum_discussions d, forum_posts p, forum_ratings r
  377 + WHERE d.forum = '$forumid'
  378 + AND p.discussion = d.id
  379 + AND r.post = p.id")) {
  380 + foreach ($ratings as $rating) {
  381 + $u = $rating->user;
  382 + $r = $rating->rating;
  383 + if (!isset($sumrating[$u])) {
  384 + $sumrating[$u][1] = 0;
  385 + $sumrating[$u][2] = 0;
  386 + $sumrating[$u][3] = 0;
385 387 }
386   - $sumrating[$user][$rating] += 1;
  388 + $sumrating[$u][$r]++;
387 389 }
388 390 foreach ($sumrating as $user => $rating) {
389 391 $return->grades[$user] = $rating[1]."s/".$rating[2]."/".$rating[3]."c";

0 comments on commit 36df40d

Please sign in to comment.
Something went wrong with that request. Please try again.