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
This commit is contained in:
drigato 2014-02-25 16:51:48 -05:00
parent cd592827fd
commit 3db1cd412a

View file

@ -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();