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:
parent
cd592827fd
commit
3db1cd412a
1 changed files with 17 additions and 7 deletions
|
@ -201,6 +201,8 @@ class Application_Service_ShowService
|
||||||
//delete entry in cc_show_rebroadcast
|
//delete entry in cc_show_rebroadcast
|
||||||
$this->deleteCcShowRebroadcasts();
|
$this->deleteCcShowRebroadcasts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->storeInstanceIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
//update ccShowDays
|
//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)
|
private function adjustSchedule($showData)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||||
|
@ -271,7 +288,6 @@ class Application_Service_ShowService
|
||||||
$ccShows = array();
|
$ccShows = array();
|
||||||
|
|
||||||
foreach ($ccShowDays as $day) {
|
foreach ($ccShowDays as $day) {
|
||||||
$this->instanceIdsForScheduleUpdates = array();
|
|
||||||
|
|
||||||
$this->ccShow = $day->getCcShow();
|
$this->ccShow = $day->getCcShow();
|
||||||
$this->isRecorded = $this->ccShow->isRecorded();
|
$this->isRecorded = $this->ccShow->isRecorded();
|
||||||
|
@ -1067,12 +1083,6 @@ SQL;
|
||||||
$ccShowInstance = $this->getInstance($utcStartDateTime);
|
$ccShowInstance = $this->getInstance($utcStartDateTime);
|
||||||
$newInstance = false;
|
$newInstance = false;
|
||||||
$updateScheduleStatus = true;
|
$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 {
|
} else {
|
||||||
$newInstance = true;
|
$newInstance = true;
|
||||||
$ccShowInstance = new CcShowInstances();
|
$ccShowInstance = new CcShowInstances();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue