Merge branch '2.4.x' of dev.sourcefabric.org:airtime into 2.4.x

This commit is contained in:
Naomi Aro 2013-05-28 13:12:15 -04:00
commit 96eefee407
2 changed files with 13 additions and 10 deletions

View File

@ -592,6 +592,7 @@ class Application_Model_Scheduler
$instance_sql); $instance_sql);
} }
$excludePositions = array();
foreach($instances as &$instance) { foreach($instances as &$instance) {
$instanceId = $instance["id"]; $instanceId = $instance["id"];
if ($id !== 0) { if ($id !== 0) {
@ -618,9 +619,8 @@ class Application_Model_Scheduler
$showStartDT = new DateTime($instance["starts"], new DateTimeZone("UTC")); $showStartDT = new DateTime($instance["starts"], new DateTimeZone("UTC"));
$nextStartDT = $this->findNextStartTime($showStartDT, $instanceId); $nextStartDT = $this->findNextStartTime($showStartDT, $instanceId);
//show is empty so start position counter at 0 //first item in show so start position counter at 0
$pos = 0; $pos = 0;
//$adjustSched = false;
} }
if (!in_array($instanceId, $affectedShowInstances)) { if (!in_array($instanceId, $affectedShowInstances)) {
@ -753,12 +753,15 @@ class Application_Model_Scheduler
$insert_sql = "INSERT INTO cc_schedule ". $insert_sql = "INSERT INTO cc_schedule ".
"(starts, ends, cue_in, cue_out, fade_in, fade_out, ". "(starts, ends, cue_in, cue_out, fade_in, fade_out, ".
"clip_length, position, instance_id, file_id, stream_id) VALUES ". "clip_length, position, instance_id, file_id, stream_id) VALUES ".
implode($values, ","); implode($values, ",")." RETURNING id";
Application_Common_Database::prepareAndExecute( $stmt = $this->con->prepare($insert_sql);
$insert_sql, array(), Application_Common_Database::EXECUTE); if ($stmt->execute()) {
foreach ($stmt->fetchAll() as $row) {
$excludeIds[] = $row["id"];
}
};
} }
// update is_scheduled flag for each cc_file // update is_scheduled flag for each cc_file
$fileIds = array(); $fileIds = array();
foreach ($filesToInsert as &$file) { foreach ($filesToInsert as &$file) {
@ -779,14 +782,14 @@ class Application_Model_Scheduler
} }
if ($adjustSched === true) { if ($adjustSched === true) {
$followingItems_sql = "SELECT * FROM cc_schedule ". $followingItems_sql = "SELECT * FROM cc_schedule ".
"WHERE starts > '{$initalStartDT->format("Y-m-d H:i:s.u")}' ". "WHERE starts >= '{$initalStartDT->format("Y-m-d H:i:s.u")}' ".
"AND instance_id = {$instanceId} "; "AND instance_id = {$instanceId} ";
if (count($excludeIds) > 0) { if (count($excludeIds) > 0) {
$followingItems_sql .= "AND id NOT IN (". implode($excludeIds, ",").") "; $followingItems_sql .= "AND id NOT IN (". implode($excludeIds, ",").") ";
} }
$followingItems_sql .= "ORDER BY starts"; $followingItems_sql .= "ORDER BY starts";
$followingSchedItems = Application_Common_Database::prepareAndExecute( $followingSchedItems = Application_Common_Database::prepareAndExecute(
$followingItems_sql); $followingItems_sql);

View File

@ -262,14 +262,14 @@ function parseItems(obj){
if (obj.currentShow.length > 0) { if (obj.currentShow.length > 0) {
calcAdditionalShowData(obj.currentShow); calcAdditionalShowData(obj.currentShow);
currentShow = obj.currentShow;
} }
if (obj.nextShow.length > 0) { if (obj.nextShow.length > 0) {
calcAdditionalShowData(obj.nextShow); calcAdditionalShowData(obj.nextShow);
nextShow = obj.nextShow;
calculateTimeToNextShow(); calculateTimeToNextShow();
} }
currentShow = obj.currentShow;
nextShow = obj.nextShow;
var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime); var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
var date = new Date(); var date = new Date();