From 6e1bf500094e2a27cc9dc1402eb533f92ceec5c7 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 12 Apr 2012 18:49:24 -0400 Subject: [PATCH] CC-3638: Dashboard: On Air and Current playing show wasn't displaying correctly - fixed --- airtime_mvc/application/models/Schedule.php | 7 ++++--- airtime_mvc/application/models/Show.php | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 63f02deb9..d491ed886 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -39,9 +39,9 @@ class Application_Model_Schedule { $utcTimeNow = $date->getUtcTimestamp(); $shows = Application_Model_Show::getPrevCurrentNext($utcTimeNow); - $previousShowID = count($shows['previousShow'])>0?$shows['previousShow'][0]['id']:null; - $currentShowID = count($shows['currentShow'])>0?$shows['currentShow'][0]['id']:null; - $nextShowID = count($shows['nextShow'])>0?$shows['nextShow'][0]['id']:null; + $previousShowID = count($shows['previousShow'])>0?$shows['previousShow'][0]['instance_id']:null; + $currentShowID = count($shows['currentShow'])>0?$shows['currentShow'][0]['instance_id']:null; + $nextShowID = count($shows['nextShow'])>0?$shows['nextShow'][0]['instance_id']:null; $results = Application_Model_Schedule::GetPrevCurrentNext($previousShowID, $currentShowID, $nextShowID, $utcTimeNow); $range = array("env"=>APPLICATION_ENV, @@ -106,6 +106,7 @@ class Application_Model_Schedule { $sql .= ' AND st.playout_status > 0 ORDER BY st.starts'; $rows = $CC_DBC->GetAll($sql); + $numberOfRows = count($rows); $results['previous'] = null; diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 161048bb8..006fa68b9 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1767,8 +1767,7 @@ class Application_Model_Show { ." AND si.ends < TIMESTAMP '$p_timeNow' + INTERVAL '2 days'" ." AND modified_instance != TRUE" ." ORDER BY si.starts"; - - //Logging::log($sql); + // Convert back to local timezone $rows = $CC_DBC->GetAll($sql); $numberOfRows = count($rows); @@ -1785,6 +1784,7 @@ class Application_Model_Show { if ( $i - 1 >= 0){ $results['previousShow'][0] = array( "id"=>$rows[$i-1]['id'], + "instance_id"=>$rows[$i-1]['instance_id'], "name"=>$rows[$i-1]['name'], "start_timestamp"=>$rows[$i-1]['start_timestamp'], "end_timestamp"=>$rows[$i-1]['end_timestamp'], @@ -1797,6 +1797,7 @@ class Application_Model_Show { if ( isset($rows[$i+1])){ $results['nextShow'][0] = array( "id"=>$rows[$i+1]['id'], + "instance_id"=>$rows[$i+1]['instance_id'], "name"=>$rows[$i+1]['name'], "start_timestamp"=>$rows[$i+1]['start_timestamp'], "end_timestamp"=>$rows[$i+1]['end_timestamp'], @@ -1814,6 +1815,7 @@ class Application_Model_Show { if (strtotime($rows[$i]['starts']) > $timeNowAsMillis) { $results['nextShow'][0] = array( "id"=>$rows[$i]['id'], + "instance_id"=>$rows[$i]['instance_id'], "name"=>$rows[$i]['name'], "start_timestamp"=>$rows[$i]['start_timestamp'], "end_timestamp"=>$rows[$i]['end_timestamp'], @@ -1827,6 +1829,7 @@ class Application_Model_Show { if (count($results['previousShow']) == 0 && isset($previousShowIndex)) { $results['previousShow'][0] = array( "id"=>$rows[$previousShowIndex]['id'], + "instance_id"=>$rows[$previousShowIndex]['instance_id'], "name"=>$rows[$previousShowIndex]['name'], "start_timestamp"=>$rows[$previousShowIndex]['start_timestamp'], "end_timestamp"=>$rows[$previousShowIndex]['end_timestamp'],