parent
070641293e
commit
b747ce6fb0
|
@ -16,8 +16,9 @@ class Application_Model_Dashboard
|
|||
if (count($row) == 0){
|
||||
return null;
|
||||
} else {
|
||||
//should never reach here. Doesnt make sense to have
|
||||
//a schedule item not within a show_instance.
|
||||
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
||||
"starts"=>$row[0]["starts"],
|
||||
"ends"=>$row[0]["ends"]);
|
||||
}
|
||||
} else {
|
||||
if (count($row) == 0){
|
||||
|
@ -53,8 +54,13 @@ class Application_Model_Dashboard
|
|||
if (count($row) == 0){
|
||||
return null;
|
||||
} else {
|
||||
//should never reach here. Doesnt make sense to have
|
||||
//a schedule item not within a show_instance.
|
||||
/* Should never reach here, but lets return the track information
|
||||
* just in case we allow tracks to be scheduled without a show
|
||||
* in the future.
|
||||
*/
|
||||
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
||||
"starts"=>$row[0]["starts"],
|
||||
"ends"=>$row[0]["ends"]);
|
||||
}
|
||||
} else {
|
||||
if (count($row) == 0){
|
||||
|
@ -62,8 +68,8 @@ class Application_Model_Dashboard
|
|||
return array("name"=>$showInstance->getName(),
|
||||
"starts"=>$showInstance->getShowStart(),
|
||||
"ends"=>$showInstance->getShowEnd(),
|
||||
"media_item_played"=>false, //TODO
|
||||
"record"=>$showInstance->isRecorded()); //TODO
|
||||
"media_item_played"=>false,
|
||||
"record"=>$showInstance->isRecorded());
|
||||
} else {
|
||||
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
||||
"starts"=>$row[0]["starts"],
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue