Todo for consistency.
This commit is contained in:
parent
99a3a8deab
commit
a3d4b8c722
|
@ -167,26 +167,33 @@ class Application_Model_ShowInstance
|
|||
$con = Propel::getConnection();
|
||||
|
||||
$instance_id = $this->getShowInstanceId();
|
||||
$sql = "SELECT starts from cc_schedule"
|
||||
." WHERE instance_id = $instance_id"
|
||||
." ORDER BY starts"
|
||||
." LIMIT 1";
|
||||
|
||||
$scheduleStarts = $con->query($sql)->fetchColumn(0);
|
||||
$sql = <<<SQL
|
||||
SELECT starts
|
||||
FROM cc_schedule
|
||||
WHERE instance_id = :instanceId
|
||||
ORDER BY starts LIMIT 1;
|
||||
SQL;
|
||||
$scheduleStarts = Application_Common_Database::prepareAndExecute( $sql,
|
||||
array( ':instanceId' => $instance_id ), 'column' );
|
||||
|
||||
if ($scheduleStarts) {
|
||||
$scheduleStartsEpoch = strtotime($scheduleStarts);
|
||||
$showStartsEpoch = strtotime($this->getShowInstanceStart());
|
||||
$showStartsEpoch = strtotime($this->getShowInstanceStart());
|
||||
|
||||
$diff = $showStartsEpoch - $scheduleStartsEpoch;
|
||||
|
||||
if ($diff != 0) {
|
||||
$sql = "UPDATE cc_schedule"
|
||||
." SET starts = starts + INTERVAL '$diff' second,"
|
||||
." ends = ends + INTERVAL '$diff' second"
|
||||
." WHERE instance_id = $instance_id";
|
||||
|
||||
$con->exec($sql);
|
||||
$sql = <<<SQL
|
||||
UPDATE cc_schedule
|
||||
SET starts = starts + INTERVAL :diff1 SECOND,
|
||||
ends = ends + INTERVAL :diff2 SECOND
|
||||
WHERE instance_id = :instanceId
|
||||
SQL;
|
||||
Application_Common_Database::prepareAndExecute($sql,
|
||||
array(
|
||||
':diff1' => $diff,
|
||||
':diff2' => $diff,
|
||||
':instanceId' => $instance_id ), 'execute');
|
||||
}
|
||||
}
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
|
|
Loading…
Reference in New Issue