diff options
author | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-06-07 00:49:47 +0000 |
---|---|---|
committer | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-06-07 00:49:47 +0000 |
commit | b9937cd7ce2a1d42070ef710f93814c945b5bbef (patch) | |
tree | dc424ecef6ab659507cd3e23029c9a8bb6c73a28 /server/ajax.server.php | |
parent | ae89b1daadcfecbbb6ab39cae0c40d589d22f0db (diff) | |
download | ampache-b9937cd7ce2a1d42070ef710f93814c945b5bbef.tar.gz ampache-b9937cd7ce2a1d42070ef710f93814c945b5bbef.tar.bz2 ampache-b9937cd7ce2a1d42070ef710f93814c945b5bbef.zip |
Clean up the rating code by moving uniqueness constraints into the database,
using SQL's AVG() when we want an average, updating the cache when a rating
changes, etc.
Diffstat (limited to 'server/ajax.server.php')
-rw-r--r-- | server/ajax.server.php | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/server/ajax.server.php b/server/ajax.server.php index 56a2e3a8..653b6173 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -303,12 +303,9 @@ switch ($_REQUEST['action']) { /* Setting ratings */ case 'set_rating': ob_start(); - $rating = new Rating($_GET['object_id'],$_GET['rating_type']); + $rating = new Rating($_GET['object_id'], $_GET['rating_type']); $rating->set_rating($_GET['rating']); - // We have to clear the cache now :( - Rating::remove_from_cache('rating_' . $_GET['rating_type'] . '_all',$_GET['object_id']); - Rating::remove_from_cache('rating_' . $_GET['rating_type'] . '_user',$_GET['object_id']); - Rating::show($_GET['object_id'],$_GET['rating_type']); + Rating::show($_GET['object_id'], $_GET['rating_type']); $key = "rating_" . $_GET['object_id'] . "_" . $_GET['rating_type']; $results[$key] = ob_get_contents(); ob_end_clean(); |