Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…k/moodle into MOODLE_21_STABLE
  • Loading branch information...
commit f69ad213c06fce708b1f38b1a95fd960c43c8ac8 2 parents 6bc136f + f8e5f3e
Eloy Lafuente (stronk7) stronk7 authored

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

  1. +5 5 mod/glossary/lib.php
10 mod/glossary/lib.php
@@ -2231,24 +2231,24 @@ function glossary_count_unrated_entries($glossaryid, $userid) {
2231 2231 // Now we need to count the ratings that this user has made
2232 2232 $sql = "SELECT COUNT('x') AS num
2233 2233 FROM {glossary_entries} e
2234   - JOIN {ratings} r ON r.itemid = e.id
  2234 + JOIN {rating} r ON r.itemid = e.id
2235 2235 WHERE e.glossaryid = :glossaryid AND
2236 2236 r.userid = :userid AND
2237 2237 r.component = 'mod_glossary' AND
2238 2238 r.ratingarea = 'entry' AND
2239 2239 r.contextid = :contextid";
2240   - $params = array('glossaryid' => $glossaryid, 'userid' => $userid, 'contextid' => $context->id);
  2240 + $params = array('glossaryid' => $glossaryid, 'userid' => $userid, 'contextid' => $contextid);
2241 2241 $rated = $DB->count_records_sql($sql, $params);
2242 2242 if ($rated) {
2243 2243 // The number or enties minus the number or rated entries equals the number of unrated
2244 2244 // entries
2245   - if ($entries->num > $rated->num) {
2246   - return $entries->num - $rated->num;
  2245 + if ($entries > $rated) {
  2246 + return $entries - $rated;
2247 2247 } else {
2248 2248 return 0; // Just in case there was a counting error
2249 2249 }
2250 2250 } else {
2251   - return $entries->num;
  2251 + return (int)$entries;
2252 2252 }
2253 2253 } else {
2254 2254 return 0;

0 comments on commit f69ad21

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