summaryrefslogtreecommitdiffstats
path: root/lib/class/tmpplaylist.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-11-24 21:48:22 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-11-24 21:48:22 +0000
commit6e299a7f63b5b5f056667dee6788fe4c5626be5f (patch)
treea4e9b70bd393d7dc260b32b347aaec74f2da9409 /lib/class/tmpplaylist.class.php
parent27ba8110cab5b09220a110f0e2f3af026582c9fc (diff)
downloadampache-6e299a7f63b5b5f056667dee6788fe4c5626be5f.tar.gz
ampache-6e299a7f63b5b5f056667dee6788fe4c5626be5f.tar.bz2
ampache-6e299a7f63b5b5f056667dee6788fe4c5626be5f.zip
fixed voting up/down and removal of songs from democratic playlist after playback
Diffstat (limited to 'lib/class/tmpplaylist.class.php')
-rw-r--r--lib/class/tmpplaylist.class.php31
1 files changed, 3 insertions, 28 deletions
diff --git a/lib/class/tmpplaylist.class.php b/lib/class/tmpplaylist.class.php
index 781067dd..9e0c5a3a 100644
--- a/lib/class/tmpplaylist.class.php
+++ b/lib/class/tmpplaylist.class.php
@@ -130,8 +130,8 @@ class tmpPlaylist {
$order = 'ORDER BY id ASC';
/* Select all objects from this playlist */
- $sql = "SELECT tmp_playlist_data.object_type, tmp_playlist_data.id, tmp_playlist_data.object_id $vote_select " .
- "FROM tmp_playlist_data $vote_join " .
+ $sql = "SELECT tmp_playlist_data.object_type, tmp_playlist_data.id, tmp_playlist_data.object_id " .
+ "FROM tmp_playlist_data " .
"WHERE tmp_playlist_data.tmp_playlist='" . Dba::escape($this->id) . "' $order";
$db_results = Dba::query($sql);
@@ -158,37 +158,12 @@ class tmpPlaylist {
$tmp_id = Dba::escape($this->id);
$order = " ORDER BY tmp_playlist_data.id DESC";
- /* Check for an item on the playlist, account for voting */
- if ($this->type == 'vote') {
- /* Add conditions for voting */
- $vote_select = ", COUNT(user_vote.user) AS `count`";
- $order = " GROUP BY tmp_playlist_data.id ORDER BY `count` DESC, user_vote.date ASC";
- $vote_join = "INNER JOIN user_vote ON user_vote.object_id=tmp_playlist_data.id";
- }
-
- $sql = "SELECT tmp_playlist_data.object_id $vote_select FROM tmp_playlist_data $vote_join " .
+ $sql = "SELECT tmp_playlist_data.object_id FROM tmp_playlist_data " .
"WHERE tmp_playlist_data.tmp_playlist = '$tmp_id' $order LIMIT 1";
$db_results = Dba::query($sql);
$results = Dba::fetch_assoc($db_results);
- /* If nothing was found and this is a voting playlist then get from base_playlist */
- if ($this->type == 'vote' AND !$results) {
-
- /* Check for a playlist */
- if ($this->base_playlist != '0') {
- /* We need to pull a random one from the base_playlist */
- $base_playlist = new playlist($this->base_playlist);
- $data = $base_playlist->get_random_songs(1);
- $results['object_id'] = $data['0'];
- }
- else {
- $sql = "SELECT id as `object_id` FROM song WHERE enabled='1' ORDER BY RAND() LIMIT 1";
- $db_results = Dba::query($sql);
- $results = Dba::fetch_assoc($db_results);
- }
- }
-
return $results['object_id'];
} // get_next_object