From 7660e0cd84d3ee5c10dc0f9f23d2a8e3bdeb076f Mon Sep 17 00:00:00 2001 From: drigato Date: Tue, 4 Mar 2014 11:29:49 -0500 Subject: [PATCH] CC-5719: Incorrect show content start time The show content was getting recalculated twice sometimes. So if the difference between the original and now show start date-time and was 2 hours, the scheduled content would have a difference of 4 hours --- .../application/services/SchedulerService.php | 24 ++++++++----------- .../application/services/ShowService.php | 5 ++-- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/airtime_mvc/application/services/SchedulerService.php b/airtime_mvc/application/services/SchedulerService.php index 60206c112..4b558cfc6 100644 --- a/airtime_mvc/application/services/SchedulerService.php +++ b/airtime_mvc/application/services/SchedulerService.php @@ -304,24 +304,20 @@ class Application_Service_SchedulerService private static function replaceInstanceContentCheck($currentShowStamp, $showStamp) { - /*$currentShowStamp = CcScheduleQuery::create() - ->filterByDbInstanceId($ccShowInstance->getDbId()) - ->orderByDbStarts() - ->find();*/ - $counter = 0; foreach ($showStamp as $item) { if ($item["file_id"] != $currentShowStamp[$counter]["file_id"] || $item["stream_id"] != $currentShowStamp[$counter]["stream_id"]) { - /*CcScheduleQuery::create() - ->filterByDbInstanceId($ccShowInstance->getDbId()) - ->delete();*/ - $delete_sql = "DELETE FROM cc_schedule ". - "WHERE instance_id = {$currentShowStamp[$counter]["instance_id"]}"; - Application_Common_Database::prepareAndExecute( - $delete_sql, array(), Application_Common_Database::EXECUTE); - return true; - } + /*CcScheduleQuery::create() + ->filterByDbInstanceId($ccShowInstance->getDbId()) + ->delete();*/ + $delete_sql = "DELETE FROM cc_schedule ". + "WHERE instance_id = {$currentShowStamp[$counter]["instance_id"]}"; + Application_Common_Database::prepareAndExecute( + $delete_sql, array(), Application_Common_Database::EXECUTE); + return true; + } + $counter += 1; } /* If we get here, the content in the show instance is the same diff --git a/airtime_mvc/application/services/ShowService.php b/airtime_mvc/application/services/ShowService.php index afb630f9d..5fdaf4f19 100644 --- a/airtime_mvc/application/services/ShowService.php +++ b/airtime_mvc/application/services/ShowService.php @@ -534,12 +534,11 @@ SQL; //check if this is null if "no end" $currentShowEndDateTime = $this->getRepeatingEndDate(); - if ($currentShowEndDateTime != $endDateTime) { - + if ($endDateTime && $currentShowEndDateTime != $endDateTime) { $endDate = clone $endDateTime; $endDate->setTimezone(new DateTimeZone("UTC")); - //show "No End" option was toggled + //show's "No End" option was toggled //or the end date comes earlier if (is_null($currentShowEndDateTime) || ($endDateTime < $currentShowEndDateTime)) { //"No End" option was unchecked so we need to delete the