CC-2482: Next Song/Previous song can still be incorrect in some rare cases

-should be fixed.
This commit is contained in:
martin 2011-06-29 14:40:56 -04:00
parent 69874fc992
commit d03cf4ca14

View file

@ -383,11 +383,17 @@ class Schedule {
public static function GetLastScheduleItem($p_timeNow){
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT *"
$sql = "SELECT"
." ft.artist_name, ft.track_title,"
." st.starts as starts, st.ends as ends"
." FROM $CC_CONFIG[scheduleTable] st"
." LEFT JOIN $CC_CONFIG[filesTable] ft"
." ON st.file_id = ft.id"
." LEFT JOIN $CC_CONFIG[showInstances] sit"
." ON st.instance_id = sit.id"
." WHERE st.ends < TIMESTAMP '$p_timeNow'"
." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows.
." AND st.starts < sit.ends"
." ORDER BY st.ends DESC"
." LIMIT 1";
@ -423,11 +429,17 @@ class Schedule {
public static function GetNextScheduleItem($p_timeNow){
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT *"
$sql = "SELECT"
." ft.artist_name, ft.track_title,"
." st.starts as starts, st.ends as ends"
." FROM $CC_CONFIG[scheduleTable] st"
." LEFT JOIN $CC_CONFIG[filesTable] ft"
." ON st.file_id = ft.id"
." LEFT JOIN $CC_CONFIG[showInstances] sit"
." ON st.instance_id = sit.id"
." WHERE st.starts > TIMESTAMP '$p_timeNow'"
." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows.
." AND st.starts < sit.ends"
." ORDER BY st.starts"
." LIMIT 1";