CC-3859: Playout History: Filter out songs that are not played out
- done
This commit is contained in:
parent
453b343284
commit
164c158c80
|
@ -254,6 +254,10 @@ class Application_Model_LiveLog
|
|||
$sql_insert = "INSERT INTO CC_LIVE_LOG (state, start_time)"
|
||||
." VALUES ('$state', '{$dateTime->format("Y-m-d H:i:s")}')";
|
||||
$con->exec($sql_insert);
|
||||
if($state == "S"){
|
||||
// if scheduled play source is getting broadcasted
|
||||
Application_Model_Schedule::UpdateBrodcastedStatus($dateTime, 1);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
|
|
@ -66,7 +66,7 @@ class Application_Model_PlayoutHistory {
|
|||
select count(schedule.file_id) as played, schedule.file_id as file_id
|
||||
from cc_schedule as schedule
|
||||
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
|
||||
and schedule.playout_status > 0 and schedule.media_item_played != FALSE
|
||||
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
|
||||
group by schedule.file_id
|
||||
)
|
||||
AS playout left join cc_files as file on (file.id = playout.file_id)";
|
||||
|
|
|
@ -293,8 +293,30 @@ class Application_Model_Schedule {
|
|||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
||||
." SET media_item_played=TRUE"
|
||||
." WHERE id=$p_id";
|
||||
." SET media_item_played=TRUE";
|
||||
// we need to update 'broadcasted' column as well
|
||||
// check the current switch status
|
||||
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'?true:false;
|
||||
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'?true:false;
|
||||
$scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on'?true:false;
|
||||
|
||||
if(!$live_dj && !$master_dj && $scheduled_play){
|
||||
$sql .= ", broadcasted=1";
|
||||
}
|
||||
|
||||
$sql .= " WHERE id=$p_id";
|
||||
|
||||
$retVal = $con->exec($sql);
|
||||
return $retVal;
|
||||
}
|
||||
|
||||
public static function UpdateBrodcastedStatus($dateTime, $value){
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$now = $dateTime->format("Y-m-d H:i:s");
|
||||
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
||||
." SET broadcasted=$value"
|
||||
." WHERE starts <= '$now' AND ends >= '$now'";
|
||||
$retVal = $con->exec($sql);
|
||||
return $retVal;
|
||||
}
|
||||
|
|
|
@ -1519,8 +1519,6 @@ class Application_Model_Show {
|
|||
$sql = $sql." AND ({$exclude})";
|
||||
}
|
||||
|
||||
Logging::debug("getShows");
|
||||
Logging::debug($sql);
|
||||
$result = $con->query($sql)->fetchAll();
|
||||
return $result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue