From 3db1cd412a15fbb4652e0aeb7e4948f62080f6b3 Mon Sep 17 00:00:00 2001 From: drigato Date: Tue, 25 Feb 2014 16:51:48 -0500 Subject: [PATCH] CC-5697: Editing a linked show's repeat day sets wrong day for show content Optimized how we store the instance ids that already exist --- .../application/services/ShowService.php | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/services/ShowService.php b/airtime_mvc/application/services/ShowService.php index d142636fc..3b129599d 100644 --- a/airtime_mvc/application/services/ShowService.php +++ b/airtime_mvc/application/services/ShowService.php @@ -201,6 +201,8 @@ class Application_Service_ShowService //delete entry in cc_show_rebroadcast $this->deleteCcShowRebroadcasts(); } + + $this->storeInstanceIds(); } //update ccShowDays @@ -229,6 +231,21 @@ class Application_Service_ShowService } } + /** + * + * Returns an array of instance ids that already exist + * We need this if a show is being updated so we can separate the + * instances that already exist and any new instances that + * get created (by adding a new repeat show day) + */ + private function storeInstanceIds() + { + $instances = $this->ccShow->getCcShowInstancess(); + foreach ($instances as $instance) { + $this->instanceIdsForScheduleUpdates[] = $instance->getDbId(); + } + } + private function adjustSchedule($showData) { $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); @@ -271,7 +288,6 @@ class Application_Service_ShowService $ccShows = array(); foreach ($ccShowDays as $day) { - $this->instanceIdsForScheduleUpdates = array(); $this->ccShow = $day->getCcShow(); $this->isRecorded = $this->ccShow->isRecorded(); @@ -1067,12 +1083,6 @@ SQL; $ccShowInstance = $this->getInstance($utcStartDateTime); $newInstance = false; $updateScheduleStatus = true; - /* Keep track of which instances in the cc_show are being - * updated. We are not interested in which instances are - * new because we won't need to update the scheduled content - * for those shows - */ - array_push($this->instanceIdsForScheduleUpdates, $ccShowInstance->getDbId()); } else { $newInstance = true; $ccShowInstance = new CcShowInstances();