From cee74b59f9468a4529753ed0affe5531f0977713 Mon Sep 17 00:00:00 2001 From: denise Date: Mon, 27 May 2013 10:39:31 -0400 Subject: [PATCH] CC-5138: Linked Show: Time limitation exceeds when adding 24 hours smart block into daily repeating & linked shows Calculate crossfades during insert instead of after --- airtime_mvc/application/models/Scheduler.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php index eb5338e66..3d0aa54ea 100644 --- a/airtime_mvc/application/models/Scheduler.php +++ b/airtime_mvc/application/models/Scheduler.php @@ -591,6 +591,7 @@ class Application_Model_Scheduler $instances = Application_Common_Database::prepareAndExecute( $instance_sql); } + foreach($instances as &$instance) { $instanceId = $instance["id"]; if ($id !== 0) { @@ -619,6 +620,7 @@ class Application_Model_Scheduler //show is empty so start position counter at 0 $pos = 0; + $adjustSched = false; } if (!in_array($instanceId, $affectedShowInstances)) { @@ -651,6 +653,7 @@ class Application_Model_Scheduler $doInsert = false; $doUpdate = false; $values = array(); + foreach ($filesToInsert as &$file) { //item existed previously and is being moved. //need to keep same id for resources if we want REST. @@ -742,16 +745,9 @@ class Application_Model_Scheduler $update_sql, array(), Application_Common_Database::EXECUTE); } - //$nextStartDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration); - $nextStartDT = $endTimeDT; + $nextStartDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration); $pos++; - /* If we are adjusting start and end times for items - * after the insert location, we need to exclude the - * schedule item we just inserted because it has correct - * start and end times*/ - //$excludeIds[] = $lastInsertId; - }//all files have been inserted/moved if ($doInsert) { $insert_sql = "INSERT INTO cc_schedule ". @@ -807,15 +803,13 @@ class Application_Model_Scheduler Application_Common_Database::prepareAndExecute( $update_sql, array(), Application_Common_Database::EXECUTE); - $nextStartDT = $endTimeDT; + $nextStartDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration); $pos++; } $pend = microtime(true); Logging::debug("adjusting all following items."); Logging::debug(floatval($pend) - floatval($pstart)); - - $this->calculateCrossfades($instanceId); } }//for each instance }//for each schedule location