CC-2729: Items in a playlist delivered from the server via JSON aren't in the proper order

-fixed
This commit is contained in:
martin 2011-08-24 18:13:50 -04:00
parent fd64c917d5
commit 7cfde811c9
1 changed files with 3 additions and 0 deletions

View File

@ -326,6 +326,7 @@ class Schedule {
." ON st.instance_id = si.id" ." ON st.instance_id = si.id"
." LEFT JOIN $CC_CONFIG[showTable] as sh" ." LEFT JOIN $CC_CONFIG[showTable] as sh"
." ON si.show_id = sh.id" ." ON si.show_id = sh.id"
//The next line ensures we only get songs that haven't ended yet
." WHERE (st.ends >= TIMESTAMP '$p_currentDateTime')" ." WHERE (st.ends >= TIMESTAMP '$p_currentDateTime')"
." AND (st.ends <= TIMESTAMP '$p_toDateTime')" ." AND (st.ends <= TIMESTAMP '$p_toDateTime')"
//next line makes sure that we aren't returning items that //next line makes sure that we aren't returning items that
@ -703,6 +704,7 @@ class Schedule {
$playlists[$pkey]['end'] = Schedule::AirtimeTimeToPypoTime($dx["end"]); $playlists[$pkey]['end'] = Schedule::AirtimeTimeToPypoTime($dx["end"]);
} }
} }
ksort($playlists);
foreach ($playlists as &$playlist) foreach ($playlists as &$playlist)
{ {
@ -729,6 +731,7 @@ class Schedule {
'end' => Schedule::AirtimeTimeToPypoTime($item["ends"]) 'end' => Schedule::AirtimeTimeToPypoTime($item["ends"])
); );
} }
ksort($medias);
$playlist['medias'] = $medias; $playlist['medias'] = $medias;
} }