CC-5697: Editing a linked show's repeat day sets wrong day for show content
When a user edits a show and changes the repeat day, we are really deleting the instances from the original repeat day and creating new instances. Therefore, we don't need to update the show content's start/end time in this case.
This commit is contained in:
parent
86dafaf61c
commit
787f19f69a
|
@ -20,6 +20,7 @@ class Application_Service_ShowService
|
|||
private $localShowStartHour;
|
||||
private $localShowStartMin;
|
||||
private $origCcShowDay;
|
||||
private $instanceIdsForScheduleUpdates;
|
||||
|
||||
public function __construct($showId=null, $showData=null, $isUpdate=false)
|
||||
{
|
||||
|
@ -39,6 +40,7 @@ class Application_Service_ShowService
|
|||
$this->isRecorded = (isset($showData['add_show_record']) && $showData['add_show_record']) ? 1 : 0;
|
||||
$this->isRebroadcast = (isset($showData['add_show_rebroadcast']) && $showData['add_show_rebroadcast']) ? 1 : 0;
|
||||
$this->isUpdate = $isUpdate;
|
||||
$this->instanceIdsForScheduleUpdates = array();
|
||||
}
|
||||
|
||||
public function editRepeatingShowInstance($showData) {
|
||||
|
@ -230,12 +232,10 @@ class Application_Service_ShowService
|
|||
private function adjustSchedule($showData)
|
||||
{
|
||||
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
$ccShowInstances = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($this->ccShow->getDbId())
|
||||
->find();
|
||||
|
||||
$this->updateScheduleStartEndTimes($showData);
|
||||
|
||||
$ccShowInstances = $this->ccShow->getCcShowInstancess();
|
||||
foreach ($ccShowInstances as $instance) {
|
||||
$instance->updateScheduleStatus($con);
|
||||
}
|
||||
|
@ -271,6 +271,7 @@ class Application_Service_ShowService
|
|||
$ccShows = array();
|
||||
|
||||
foreach ($ccShowDays as $day) {
|
||||
$this->instanceIdsForScheduleUpdates = array();
|
||||
|
||||
$this->ccShow = $day->getCcShow();
|
||||
$this->isRecorded = $this->ccShow->isRecorded();
|
||||
|
@ -881,7 +882,6 @@ SQL;
|
|||
private function updateScheduleStartEndTimes($showData)
|
||||
{
|
||||
$showId = $this->ccShow->getDbId();
|
||||
|
||||
//DateTime in show's local time
|
||||
$newStartDateTime = new DateTime($showData["add_show_start_date"]." ".
|
||||
$showData["add_show_start_time"],
|
||||
|
@ -890,12 +890,9 @@ SQL;
|
|||
$diff = $this->calculateShowStartDiff($newStartDateTime,
|
||||
$this->origCcShowDay->getLocalStartDateAndTime());
|
||||
|
||||
$ccShowInstances = $this->ccShow->getFutureCcShowInstancess();
|
||||
$instanceIds = array();
|
||||
foreach ($ccShowInstances as $ccShowInstance) {
|
||||
array_push($instanceIds, $ccShowInstance->getDbId());
|
||||
}
|
||||
Application_Service_SchedulerService::updateScheduleStartTime($instanceIds, $diff);
|
||||
Application_Service_SchedulerService::updateScheduleStartTime(
|
||||
$this->instanceIdsForScheduleUpdates,
|
||||
$diff);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1070,6 +1067,7 @@ SQL;
|
|||
$ccShowInstance = $this->getInstance($utcStartDateTime);
|
||||
$newInstance = false;
|
||||
$updateScheduleStatus = true;
|
||||
array_push($this->instanceIdsForScheduleUpdates, $ccShowInstance->getDbId());
|
||||
} else {
|
||||
$newInstance = true;
|
||||
$ccShowInstance = new CcShowInstances();
|
||||
|
|
Loading…
Reference in New Issue