diff options
Diffstat (limited to 'lib/class/rating.class.php')
-rw-r--r-- | lib/class/rating.class.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/class/rating.class.php b/lib/class/rating.class.php index 1ddd842a..ff7b940d 100644 --- a/lib/class/rating.class.php +++ b/lib/class/rating.class.php @@ -64,12 +64,12 @@ class Rating { $user_id = Dba::escape($user_id); - $sql = "SELECT `score` FROM `rating` WHERE `user`='$user_id' AND `object_id`='$this->id' AND `object_type`='$this->type'"; + $sql = "SELECT `rating` FROM `rating` WHERE `user`='$user_id' AND `object_id`='$this->id' AND `object_type`='$this->type'"; $db_results = Dba::query($sql); $results = Dba::fetch_assoc($db_results); - return $results['score']; + return $results['rating']; } // get_user @@ -82,14 +82,14 @@ class Rating { */ public function get_average() { - $sql = "SELECT `score` FROM `rating` WHERE `object_id`='$this->id' AND `object_type`='$this->type'"; + $sql = "SELECT `rating` FROM `rating` WHERE `object_id`='$this->id' AND `object_type`='$this->type'"; $db_results = Dba::query($sql); $i = 0; while ($r = Dba::fetch_assoc($db_results)) { $i++; - $total += $r['score']; + $total += $r['rating']; } // while we're pulling results if ($total > 0) { @@ -123,11 +123,11 @@ class Rating { $db_results = Dba::query($sql); if ($existing = Dba::fetch_assoc($db_results)) { - $sql = "UPDATE `rating` SET `score`='$score' WHERE `id`='" . $existing['id'] . "'"; + $sql = "UPDATE `rating` SET `rating`='$score' WHERE `id`='" . $existing['id'] . "'"; $db_results = Dba::query($sql); } else { - $sql = "INSERT INTO `rating` (`object_id`,`object_type`,`score`,`user`) VALUES " . + $sql = "INSERT INTO `rating` (`object_id`,`object_type`,`rating`,`user`) VALUES " . " ('$this->id','$this->type','$score','" . $GLOBALS['user']->id . "')"; $db_results = Dba::query($sql); } |