diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-09-12 07:30:55 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-09-12 07:30:55 +0000 |
commit | bff9e37fa5fa41111b5b06ce6cdcb0eb8e5c21f9 (patch) | |
tree | f9f61787479b286e5ae5efb96447107c10dd553e /lib/class/rating.class.php | |
parent | c99ad11ee04fa811aaf6988a2daa0567ab6ee0d8 (diff) | |
download | ampache-bff9e37fa5fa41111b5b06ce6cdcb0eb8e5c21f9.tar.gz ampache-bff9e37fa5fa41111b5b06ce6cdcb0eb8e5c21f9.tar.bz2 ampache-bff9e37fa5fa41111b5b06ce6cdcb0eb8e5c21f9.zip |
more work on the localplay stuff, most details ironed out, just needs some code to back it up, also tweaked plugins and threw in some extra goodies in the preference class, also pimped out the error class
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); } |