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

Refactored show creation into separate function
This commit is contained in:
drigato 2014-08-15 15:35:58 -04:00
parent fe8e004d87
commit 20bd2ad9d5
2 changed files with 14 additions and 15 deletions

View File

@ -971,13 +971,7 @@ SQL;
$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);
}
Application_Model_Show::createAndFillShowInstancesPastPopulatedUntilDate($needScheduleUntil);
list($range_start, $range_end) = self::getRangeStartAndEnd($p_fromDateTime, $p_toDateTime);

View File

@ -830,6 +830,18 @@ SQL;
}
}
public static function createAndFillShowInstancesPastPopulatedUntilDate($needScheduleUntil)
{
//UTC DateTime object
$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);
}
}
/**
* Get all the show instances in the given time range (inclusive).
@ -844,14 +856,7 @@ SQL;
*/
public static function getShows($start_timestamp, $end_timestamp, $onlyRecord=FALSE)
{
//UTC DateTime object
$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() < $end_timestamp->getTimestamp()) {
$service_show = new Application_Service_ShowService();
$ccShow = $service_show->delegateInstanceCreation(null, $end_timestamp, true);
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
}
self::createAndFillShowInstancesPastPopulatedUntilDate($end_timestamp);
$sql = <<<SQL
SELECT si1.starts AS starts,