Permalink
Browse files

Merge branch 'w04_MDL-31183_m21_gloscounts' of git://github.com/skoda…

…k/moodle into MOODLE_21_STABLE
  • Loading branch information...
2 parents 6bc136f + f8e5f3e commit f69ad213c06fce708b1f38b1a95fd960c43c8ac8 @stronk7 stronk7 committed Jan 24, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 mod/glossary/lib.php
View
@@ -2231,24 +2231,24 @@ function glossary_count_unrated_entries($glossaryid, $userid) {
// Now we need to count the ratings that this user has made
$sql = "SELECT COUNT('x') AS num
FROM {glossary_entries} e
- JOIN {ratings} r ON r.itemid = e.id
+ JOIN {rating} r ON r.itemid = e.id
WHERE e.glossaryid = :glossaryid AND
r.userid = :userid AND
r.component = 'mod_glossary' AND
r.ratingarea = 'entry' AND
r.contextid = :contextid";
- $params = array('glossaryid' => $glossaryid, 'userid' => $userid, 'contextid' => $context->id);
+ $params = array('glossaryid' => $glossaryid, 'userid' => $userid, 'contextid' => $contextid);
$rated = $DB->count_records_sql($sql, $params);
if ($rated) {
// The number or enties minus the number or rated entries equals the number of unrated
// entries
- if ($entries->num > $rated->num) {
- return $entries->num - $rated->num;
+ if ($entries > $rated) {
+ return $entries - $rated;
} else {
return 0; // Just in case there was a counting error
}
} else {
- return $entries->num;
+ return (int)$entries;
}
} else {
return 0;

0 comments on commit f69ad21

Please sign in to comment.