SAAS-1121: New link show instances don't get created sometimes if there is no show content

Fixed by checking if the linked show is empty before trying to copy its
tracks into new show instances
This commit is contained in:
drigato 2015-10-13 11:08:17 -04:00
parent ee70a0dbea
commit 7f64edafff
1 changed files with 58 additions and 56 deletions

View File

@ -234,8 +234,9 @@ class Application_Service_SchedulerService
//with content from $linkedShowSchedule. //with content from $linkedShowSchedule.
try { try {
$con->beginTransaction(); $con->beginTransaction();
foreach ($instanceIdsToFill as $id)
{ if (!empty($linkedShowSchedule)) {
foreach ($instanceIdsToFill as $id) {
//Start by clearing the show instance that needs to be filling. This ensure //Start by clearing the show instance that needs to be filling. This ensure
//we're not going to get in trouble in case there's an programming error somewhere else. //we're not going to get in trouble in case there's an programming error somewhere else.
self::clearShowInstanceContents($id); self::clearShowInstanceContents($id);
@ -279,9 +280,9 @@ class Application_Service_SchedulerService
} //foreach show item } //foreach show item
if (!empty($values)) { if (!empty($values)) {
$insert_sql = "INSERT INTO cc_schedule (starts, ends, ". $insert_sql = "INSERT INTO cc_schedule (starts, ends, " .
"clip_length, fade_in, fade_out, cue_in, cue_out, ". "clip_length, fade_in, fade_out, cue_in, cue_out, " .
"file_id, stream_id, instance_id, position) VALUES ". "file_id, stream_id, instance_id, position) VALUES " .
implode($values, ","); implode($values, ",");
Application_Common_Database::prepareAndExecute( Application_Common_Database::prepareAndExecute(
$insert_sql, array(), Application_Common_Database::EXECUTE); $insert_sql, array(), Application_Common_Database::EXECUTE);
@ -291,6 +292,7 @@ class Application_Service_SchedulerService
$instance = CcShowInstancesQuery::create()->findPk($id); $instance = CcShowInstancesQuery::create()->findPk($id);
$instance->updateScheduleStatus($con); $instance->updateScheduleStatus($con);
} //foreach linked instance } //foreach linked instance
}
//update time_filled and last_scheduled in cc_show_instances //update time_filled and last_scheduled in cc_show_instances
$now = gmdate(DEFAULT_TIMESTAMP_FORMAT); $now = gmdate(DEFAULT_TIMESTAMP_FORMAT);