CC-5898: Future repeating shows may not get generated and/or filled with content

Create and fill show instances when pypo requests the schedule
Changed getCcShowInstancess function to return all instances
Changed some function calls to retrieve only show instances scheduled in the future
This commit is contained in:
drigato 2014-08-16 11:05:55 -04:00
parent 1d43200041
commit 520387fcad
5 changed files with 27 additions and 7 deletions

View file

@ -967,6 +967,21 @@ SQL;
public static function getSchedule($p_fromDateTime = null, $p_toDateTime = null) public static function getSchedule($p_fromDateTime = null, $p_toDateTime = null)
{ {
//generate repeating shows if we are fetching the schedule
//for days beyond the shows_populated_until value in cc_pref
$needScheduleUntil = $p_toDateTime;
if (is_null($needScheduleUntil)) {
$needScheduleUntil = new DateTime("now", new DateTimeZone("UTC"));
$needScheduleUntil->add(new DateInterval("P1D"));
}
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
//if application is requesting shows past our previous populated until date, generate shows up until this point.
if (is_null($showsPopUntil) || $showsPopUntil->getTimestamp() < $needScheduleUntil->getTimestamp()) {
$service_show = new Application_Service_ShowService();
$ccShow = $service_show->delegateInstanceCreation(null, $needScheduleUntil, true);
Application_Model_Preference::SetShowsPopulatedUntil($needScheduleUntil);
}
list($range_start, $range_end) = self::getRangeStartAndEnd($p_fromDateTime, $p_toDateTime); list($range_start, $range_end) = self::getRangeStartAndEnd($p_fromDateTime, $p_toDateTime);
$data = array(); $data = array();

View file

@ -952,7 +952,7 @@ class Application_Model_Scheduler
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId); $ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
$ccShow = $ccShowInstance->getCcShow(); $ccShow = $ccShowInstance->getCcShow();
if ($ccShow->isLinked()) { if ($ccShow->isLinked()) {
return $ccShow->getCcShowInstancess(); return $ccShow->getFutureCcShowInstancess();
} else { } else {
return array($ccShowInstance); return array($ccShowInstance);
} }

View file

@ -250,7 +250,6 @@ class CcShow extends BaseCcShow {
return CcShowInstancesQuery::create(null, $criteria) return CcShowInstancesQuery::create(null, $criteria)
->filterByCcShow($this) ->filterByCcShow($this)
->filterByDbModifiedInstance(false) ->filterByDbModifiedInstance(false)
->filterByDbEnds(gmdate("Y-m-d H:i:s"), criteria::GREATER_THAN)
->orderByDbId() ->orderByDbId()
->find($con); ->find($con);

View file

@ -335,7 +335,7 @@ class Application_Service_SchedulerService
$instanceIds = array(); $instanceIds = array();
if ($ccShowInstance->getCcShow()->isLinked()) { if ($ccShowInstance->getCcShow()->isLinked()) {
foreach ($ccShowInstance->getCcShow()->getCcShowInstancess() as $instance) { foreach ($ccShowInstance->getCcShow()->getFutureCcShowInstancess() as $instance) {
$instanceIds[] = $instance->getDbId(); $instanceIds[] = $instance->getDbId();
$instances[] = $instance; $instances[] = $instance;
} }

View file

@ -256,19 +256,25 @@ class Application_Service_ShowService
*/ */
private function storeInstanceIds() private function storeInstanceIds()
{ {
$instances = $this->ccShow->getCcShowInstancess(); $instances = $this->ccShow->getFutureCcShowInstancess();
foreach ($instances as $instance) { foreach ($instances as $instance) {
$this->instanceIdsForScheduleUpdates[] = $instance->getDbId(); $this->instanceIdsForScheduleUpdates[] = $instance->getDbId();
} }
} }
/**
*
* Adjusts the items in cc_schedule to reflect the
* new (if one) start and end time of the show getting updated
* @param $showData
*/
private function adjustSchedule($showData) private function adjustSchedule($showData)
{ {
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
$this->updateScheduleStartEndTimes($showData); $this->updateScheduleStartEndTimes($showData);
$ccShowInstances = $this->ccShow->getCcShowInstancess(); $ccShowInstances = $this->ccShow->getFutureCcShowInstancess();
foreach ($ccShowInstances as $instance) { foreach ($ccShowInstances as $instance) {
$instance->updateScheduleStatus($con); $instance->updateScheduleStatus($con);
} }
@ -585,10 +591,10 @@ SQL;
private function preserveLinkedShowContent() private function preserveLinkedShowContent()
{ {
/* Get show content from any linked instance. It doesn't /* Get show content from any future linked instance. It doesn't
* matter which instance since content is the same in all. * matter which instance since content is the same in all.
*/ */
$ccShowInstance = $this->ccShow->getCcShowInstancess()->getFirst(); $ccShowInstance = $this->ccShow->getFutureCcShowInstancess()->getFirst();
if (!$ccShowInstance) { if (!$ccShowInstance) {
return; return;