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);
$sql = "SELECT * FROM cc_show_instances ".
"WHERE id = {$instanceId}";
$instance = Application_Common_Database::prepareAndExecute(
$sql, array(), Application_Common_Database::SINGLE);
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
if (is_null($instance)) { if (is_null($instance)) {
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!")); throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
} }
$itemStartDT = $instance->getDbStarts(null); $itemStartDT = new DateTime($instance["starts"], new DateTimeZone("UTC"));
$itemEndDT = null; $itemEndDT = null;
$schedule = CcScheduleQuery::create() $schedule_sql = "SELECT * FROM cc_schedule ".
->filterByDbInstanceId($showInstance) "WHERE instance_id = {$instanceId} ".
->orderByDbStarts() "ORDER BY starts";
->find($this->con); $schedule = Application_Common_Database::prepareAndExecute($schedule_sql);
foreach ($schedule as $item) { foreach ($schedule as $item) {
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength()); $itemEndDT = $this->findEndTime($itemStartDT, $item["clip_length"]);
$item->setDbStarts($itemStartDT) $update_sql = "UPDATE cc_schedule SET ".
->setDbEnds($itemEndDT); "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);
$itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration); $itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration);
} }
$schedule->save($this->con);
} }
/* /*
@ -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++;