CC-3296: Sometimes the Current Playing Item on the top Panel in the UI incorrectly shows "Nothing Scheduled"

This commit is contained in:
Martin Konecny 2012-02-02 14:11:03 -05:00
parent b2ed751e9e
commit 11e0f3ead8
1 changed files with 10 additions and 0 deletions

View File

@ -784,6 +784,7 @@ class Application_Model_ShowInstance {
$sql = "SELECT si.id"
." FROM $CC_CONFIG[showInstances] si"
." WHERE si.ends < TIMESTAMP '$p_timeNow'"
." AND si.modified_instance = 'f'"
." ORDER BY si.ends DESC"
." LIMIT 1";
@ -798,10 +799,18 @@ class Application_Model_ShowInstance {
public static function GetCurrentShowInstance($p_timeNow){
global $CC_CONFIG, $CC_DBC;
/* Orderby si.starts descending, because in some cases
* we can have multiple shows overlapping each other. In
* this case, the show that started later is the one that
* is actually playing, and so this is the one we want.
*/
$sql = "SELECT si.id"
." FROM $CC_CONFIG[showInstances] si"
." WHERE si.starts <= TIMESTAMP '$p_timeNow'"
." AND si.ends > TIMESTAMP '$p_timeNow'"
." AND si.modified_instance = 'f'"
." ORDER BY si.starts DESC"
." LIMIT 1";
$id = $CC_DBC->GetOne($sql);
@ -818,6 +827,7 @@ class Application_Model_ShowInstance {
$sql = "SELECT si.id"
." FROM $CC_CONFIG[showInstances] si"
." WHERE si.starts > TIMESTAMP '$p_timeNow'"
." AND si.modified_instance = 'f'"
." ORDER BY si.starts"
." LIMIT 1";