CC-5138: Linked Show: Time limitation exceeds when adding 24 hours smart block into daily repeating & linked shows

Removed propel from calculateCrossfades function and used prepared statements instead
This commit is contained in:
denise 2013-05-23 16:10:00 -04:00
parent 16bd407136
commit e104146b9a

View file

@ -424,33 +424,39 @@ class Application_Model_Scheduler
* This function recalculates the start/end times of items in a gapless show to * This function recalculates the start/end times of items in a gapless show to
* account for crossfade durations. * account for crossfade durations.
*/ */
private function calculateCrossfades($showInstance) private function calculateCrossfades($instanceId)
{ {
Logging::info("adjusting start, end times of scheduled items to account for crossfades show instance #".$showInstance); Logging::info("adjusting start, end times of scheduled items to account for crossfades show instance #".$instanceId);
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con); $sql = "SELECT * FROM cc_show_instances ".
if (is_null($instance)) { "WHERE id = {$instanceId}";
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!")); $instance = Application_Common_Database::prepareAndExecute(
} $sql, array(), Application_Common_Database::SINGLE);
$itemStartDT = $instance->getDbStarts(null); if (is_null($instance)) {
$itemEndDT = null; throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
}
$schedule = CcScheduleQuery::create() $itemStartDT = new DateTime($instance["starts"], new DateTimeZone("UTC"));
->filterByDbInstanceId($showInstance) $itemEndDT = null;
->orderByDbStarts()
->find($this->con);
foreach ($schedule as $item) { $schedule_sql = "SELECT * FROM cc_schedule ".
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength()); "WHERE instance_id = {$instanceId} ".
"ORDER BY starts";
$schedule = Application_Common_Database::prepareAndExecute($schedule_sql);
$item->setDbStarts($itemStartDT) foreach ($schedule as $item) {
->setDbEnds($itemEndDT); $itemEndDT = $this->findEndTime($itemStartDT, $item["clip_length"]);
$itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration); $update_sql = "UPDATE cc_schedule SET ".
} "starts = '{$itemStartDT->format("Y-m-d H:i:s")}', ".
"ends = '{$itemEndDT->format("Y-m-d H:i:s")}' ".
"WHERE id = {$item["id"]}";
Application_Common_Database::prepareAndExecute(
$update_sql, array(), Application_Common_Database::EXECUTE);
$schedule->save($this->con); $itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration);
}
} }
/* /*
@ -526,7 +532,6 @@ class Application_Model_Scheduler
$dropIndex_sql, array(), Application_Common_Database::EXECUTE); $dropIndex_sql, array(), Application_Common_Database::EXECUTE);
foreach ($scheduleItems as $schedule) { foreach ($scheduleItems as $schedule) {
Logging::info($schedule);
$id = intval($schedule["id"]); $id = intval($schedule["id"]);
/* Find out if the show where the cursor position (where an item will /* Find out if the show where the cursor position (where an item will
@ -737,6 +742,7 @@ class Application_Model_Scheduler
$update_sql, array(), Application_Common_Database::EXECUTE); $update_sql, array(), Application_Common_Database::EXECUTE);
} }
//$nextStartDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration);
$nextStartDT = $endTimeDT; $nextStartDT = $endTimeDT;
$pos++; $pos++;