cc-2344: wrong song displayed

-fixed
This commit is contained in:
martin 2011-06-02 12:45:57 -04:00
parent 070641293e
commit b747ce6fb0
2 changed files with 20 additions and 6 deletions

View file

@ -397,12 +397,20 @@ class Schedule {
public static function GetCurrentScheduleItem($p_timeNow){
global $CC_CONFIG, $CC_DBC;
/* Note that usually there will be one result returned. In some
* rare cases two songs are returned. This happens when a track
* that was overbooked from a previous show appears as if it
* hasnt ended yet (track end time hasn't been reached yet). For
* this reason, we need to get the track that starts later, as
* this is the *real* track that is currently playing. So this
* is why we are ordering by track start time. */
$sql = "SELECT *"
." FROM $CC_CONFIG[scheduleTable] st"
." LEFT JOIN $CC_CONFIG[filesTable] ft"
." ON st.file_id = ft.id"
." WHERE st.starts <= TIMESTAMP '$p_timeNow'"
." AND st.ends > TIMESTAMP '$p_timeNow'"
." ORDER BY st.starts DESC"
." LIMIT 1";
$row = $CC_DBC->GetAll($sql);