Fixed rebroadcast date bug

This commit is contained in:
denise 2013-03-08 12:06:45 -05:00
parent 846e940f82
commit 9be6b82d97
1 changed files with 6 additions and 8 deletions

View File

@ -103,8 +103,7 @@ class Application_Service_ShowInstanceService
/* /*
* Create a DatePeriod object in the user's local time * Create a DatePeriod object in the user's local time
* It will get converted to UTC right before the show instance * It will get converted to UTC before the show instance gets created
* gets created
*/ */
$period = new DatePeriod(new DateTime($start, new DateTimeZone($timezone)), $period = new DatePeriod(new DateTime($start, new DateTimeZone($timezone)),
new DateInterval($repeatInterval), $populateUntil); new DateInterval($repeatInterval), $populateUntil);
@ -114,6 +113,8 @@ class Application_Service_ShowInstanceService
$utcLastShowDateTime = $last_show ? Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null; $utcLastShowDateTime = $last_show ? Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null;
foreach ($period as $date) { foreach ($period as $date) {
list($utcStartDateTime, $utcEndDateTime) = $this->service_show->createUTCStartEndDateTime(
$date->format("Y-m-d H:i:s"), $duration, $timezone);
/* /*
* Make sure start date is less than populate until date AND * Make sure start date is less than populate until date AND
* last show date is null OR start date is less than last show date * last show date is null OR start date is less than last show date
@ -121,19 +122,16 @@ class Application_Service_ShowInstanceService
if ($utcStartDateTime->getTimestamp() <= $populateUntil->getTimestamp() && if ($utcStartDateTime->getTimestamp() <= $populateUntil->getTimestamp() &&
is_null($utcLastShowDateTime) || $utcStartDateTime->getTimestamp() < $utcLastShowDateTime->getTimestamp()) { is_null($utcLastShowDateTime) || $utcStartDateTime->getTimestamp() < $utcLastShowDateTime->getTimestamp()) {
list($utcStartDateTime, $utcEndDateTime) = $this->service_show->createUTCStartEndDateTime(
$date->format("Y-m-d H:i:s"), $duration, $timezone);
$ccShowInstance = new CcShowInstances(); $ccShowInstance = new CcShowInstances();
$ccShowInstance->setDbShowId($show_id); $ccShowInstance->setDbShowId($show_id);
$ccShowInstance->setDbStarts($utcStartDateTime); $ccShowInstance->setDbStarts($utcStartDateTime);
$ccShowInstance->setDbEnds($utcEndDateTime); $ccShowInstance->setDbEnds($utcEndDateTime);
$ccShowInstance->setDbRecord($record); $ccShowInstance->setDbRecord($record);
$ccShowInstance->save(); $ccShowInstance->save();
}
if ($isRebroadcast) { if ($isRebroadcast) {
self::createRebroadcastShowInstances($showDay, $date->format("Y-m-d"), $ccShowInstance->getDbId()); self::createRebroadcastShowInstances($showDay, $date->format("Y-m-d"), $ccShowInstance->getDbId());
}
} }
} }
} }