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:
parent
fe8e004d87
commit
20bd2ad9d5
|
@ -971,13 +971,7 @@ SQL;
|
||||||
$needScheduleUntil = new DateTime("now", new DateTimeZone("UTC"));
|
$needScheduleUntil = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
$needScheduleUntil->add(new DateInterval("P1D"));
|
$needScheduleUntil->add(new DateInterval("P1D"));
|
||||||
}
|
}
|
||||||
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
Application_Model_Show::createAndFillShowInstancesPastPopulatedUntilDate($needScheduleUntil);
|
||||||
//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);
|
||||||
|
|
||||||
|
|
|
@ -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).
|
* 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)
|
public static function getShows($start_timestamp, $end_timestamp, $onlyRecord=FALSE)
|
||||||
{
|
{
|
||||||
//UTC DateTime object
|
self::createAndFillShowInstancesPastPopulatedUntilDate($end_timestamp);
|
||||||
$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT si1.starts AS starts,
|
SELECT si1.starts AS starts,
|
||||||
|
|
Loading…
Reference in New Issue