cc-2344: wrong song displayed

-fixed #2
This commit is contained in:
martin 2011-06-03 17:03:11 -04:00
parent c9c9ecf2cd
commit e69f9497ed
2 changed files with 9 additions and 11 deletions

View file

@ -10,8 +10,7 @@ class Application_Model_Dashboard
//name. Else return the last item from the schedule. //name. Else return the last item from the schedule.
$showInstance = ShowInstance::GetLastShowInstance($p_timeNow); $showInstance = ShowInstance::GetLastShowInstance($p_timeNow);
$instanceId = $showInstance->getShowId(); $row = Schedule::GetLastScheduleItem($p_timeNow);
$row = Schedule::GetLastScheduleItem($p_timeNow, $instanceId);
if (is_null($showInstance)){ if (is_null($showInstance)){
if (count($row) == 0){ if (count($row) == 0){
@ -48,10 +47,12 @@ class Application_Model_Dashboard
//after the last item in the schedule table, then return the show's //after the last item in the schedule table, then return the show's
//name. Else return the last item from the schedule. //name. Else return the last item from the schedule.
$row = array();
$showInstance = ShowInstance::GetCurrentShowInstance($p_timeNow); $showInstance = ShowInstance::GetCurrentShowInstance($p_timeNow);
$instanceId = $showInstance->getShowId(); if (!is_null($showInstance)){
$row = Schedule::GetCurrentScheduleItem($p_timeNow, $instanceId); $instanceId = $showInstance->getShowInstanceId();
$row = Schedule::GetCurrentScheduleItem($p_timeNow, $instanceId);
}
if (is_null($showInstance)){ if (is_null($showInstance)){
if (count($row) == 0){ if (count($row) == 0){
return null; return null;
@ -84,8 +85,7 @@ class Application_Model_Dashboard
//name. Else return the last item from the schedule. //name. Else return the last item from the schedule.
$showInstance = ShowInstance::GetNextShowInstance($p_timeNow); $showInstance = ShowInstance::GetNextShowInstance($p_timeNow);
$instanceId = $showInstance->getShowId(); $row = Schedule::GetNextScheduleItem($p_timeNow);
$row = Schedule::GetNextScheduleItem($p_timeNow, $instanceId);
if (is_null($showInstance)){ if (is_null($showInstance)){
if (count($row) == 0){ if (count($row) == 0){

View file

@ -378,7 +378,7 @@ class Schedule {
"apiKey"=>$CC_CONFIG['apiKey'][0]); "apiKey"=>$CC_CONFIG['apiKey'][0]);
} }
public static function GetLastScheduleItem($p_timeNow, $p_instanceId){ public static function GetLastScheduleItem($p_timeNow){
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$sql = "SELECT *" $sql = "SELECT *"
@ -386,7 +386,6 @@ class Schedule {
." LEFT JOIN $CC_CONFIG[filesTable] ft" ." LEFT JOIN $CC_CONFIG[filesTable] ft"
." ON st.file_id = ft.id" ." ON st.file_id = ft.id"
." WHERE st.ends < TIMESTAMP '$p_timeNow'" ." WHERE st.ends < TIMESTAMP '$p_timeNow'"
." AND st.instance_id = $p_instanceId"
." ORDER BY st.ends DESC" ." ORDER BY st.ends DESC"
." LIMIT 1"; ." LIMIT 1";
@ -419,7 +418,7 @@ class Schedule {
return $row; return $row;
} }
public static function GetNextScheduleItem($p_timeNow, $p_instanceId){ public static function GetNextScheduleItem($p_timeNow){
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$sql = "SELECT *" $sql = "SELECT *"
@ -427,7 +426,6 @@ class Schedule {
." LEFT JOIN $CC_CONFIG[filesTable] ft" ." LEFT JOIN $CC_CONFIG[filesTable] ft"
." ON st.file_id = ft.id" ." ON st.file_id = ft.id"
." WHERE st.starts > TIMESTAMP '$p_timeNow'" ." WHERE st.starts > TIMESTAMP '$p_timeNow'"
." AND st.instance_id = $p_instanceId"
." ORDER BY st.starts" ." ORDER BY st.starts"
." LIMIT 1"; ." LIMIT 1";