CC-3094: Rebroadcast editing problems
-Fixed
This commit is contained in:
parent
757b2cac4f
commit
317bed8643
2 changed files with 32 additions and 7 deletions
|
@ -1524,21 +1524,42 @@ class Application_Model_Show {
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setShowFirstShow($s_date){
|
/* Takes in a UTC DateTime object.
|
||||||
|
* Converts this to local time, since cc_show days
|
||||||
|
* requires local time. */
|
||||||
|
public function setShowFirstShow($p_dt){
|
||||||
|
|
||||||
|
//clone object since we are modifying it and it was passed by reference.
|
||||||
|
$dt = clone $p_dt;
|
||||||
|
|
||||||
|
$dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
$showDay = CcShowDaysQuery::create()
|
$showDay = CcShowDaysQuery::create()
|
||||||
->filterByDbShowId($this->_showId)
|
->filterByDbShowId($this->_showId)
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
$showDay->setDbFirstShow($s_date)
|
$showDay->setDbFirstShow($dt)
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setShowLastShow($e_date){
|
/* Takes in a UTC DateTime object
|
||||||
|
* Converts this to local time, since cc_show days
|
||||||
|
* requires local time. */
|
||||||
|
public function setShowLastShow($p_dt){
|
||||||
|
|
||||||
|
//clone object since we are modifying it and it was passed by reference.
|
||||||
|
$dt = clone $p_dt;
|
||||||
|
|
||||||
|
$dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
|
//add one day since the Last Show date in CcShowDays is non-inclusive.
|
||||||
|
$dt->add(new DateInterval("P1D"));
|
||||||
|
|
||||||
$showDay = CcShowDaysQuery::create()
|
$showDay = CcShowDaysQuery::create()
|
||||||
->filterByDbShowId($this->_showId)
|
->filterByDbShowId($this->_showId)
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
$showDay->setDbLastShow($e_date)
|
$showDay->setDbLastShow($dt)
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,10 @@ class Application_Model_ShowInstance {
|
||||||
return new Application_Model_Show($this->getShowId());
|
return new Application_Model_Show($this->getShowId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function is weird. It should return a boolean, but instead returns
|
||||||
|
* an integer if it is a rebroadcast, or returns null if it isn't. You can convert
|
||||||
|
* it to boolean by using is_null(isRebroadcast), where true means isn't and false
|
||||||
|
* means that it is. */
|
||||||
public function isRebroadcast()
|
public function isRebroadcast()
|
||||||
{
|
{
|
||||||
return $this->_showInstance->getDbOriginalShow();
|
return $this->_showInstance->getDbOriginalShow();
|
||||||
|
@ -231,9 +235,9 @@ class Application_Model_ShowInstance {
|
||||||
$this->correctScheduleStartTimes();
|
$this->correctScheduleStartTimes();
|
||||||
|
|
||||||
$show = new Application_Model_Show($this->getShowId());
|
$show = new Application_Model_Show($this->getShowId());
|
||||||
if(!$show->isRepeating()){
|
if(!$show->isRepeating() && is_null($this->isRebroadcast())){
|
||||||
$show->setShowFirstShow($new_starts);
|
$show->setShowFirstShow($newStartsDateTime);
|
||||||
$show->setShowLastShow($new_ends);
|
$show->setShowLastShow($newEndsDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application_Model_RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue