removed unused code. reformatted some comments.
This commit is contained in:
parent
d805995e72
commit
c28f3af9cf
1 changed files with 10 additions and 32 deletions
|
@ -178,17 +178,16 @@ class Application_Model_Show
|
||||||
->filterByDbShowId($this->_showId)
|
->filterByDbShowId($this->_showId)
|
||||||
->find($con);
|
->find($con);
|
||||||
|
|
||||||
/* Check if the show being resized and any of its repeats
|
/* Check if the show being resized and any of its repeats * overlap
|
||||||
* overlap with other scheduled shows
|
with other scheduled shows */
|
||||||
*/
|
|
||||||
foreach ($showInstances as $si) {
|
foreach ($showInstances as $si) {
|
||||||
$startsDateTime = new DateTime($si->getDbStarts(), new DateTimeZone("UTC"));
|
$startsDateTime = new DateTime($si->getDbStarts(), new DateTimeZone("UTC"));
|
||||||
$endsDateTime = new DateTime($si->getDbEnds(), new DateTimeZone("UTC"));
|
$endsDateTime = new DateTime($si->getDbEnds(), new DateTimeZone("UTC"));
|
||||||
|
|
||||||
/* The user is moving the show on the calendar from the perspective of local time.
|
/* The user is moving the show on the calendar from the perspective
|
||||||
* incase a show is moved across a time change border offsets should be added to the local
|
of local time. * incase a show is moved across a time change
|
||||||
* timestamp and then converted back to UTC to avoid show time changes
|
border offsets should be added to the local * timestamp and
|
||||||
*/
|
then converted back to UTC to avoid show time changes */
|
||||||
$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
|
@ -208,30 +207,12 @@ class Application_Model_Show
|
||||||
}
|
}
|
||||||
|
|
||||||
$hours = $deltaMin/60;
|
$hours = $deltaMin/60;
|
||||||
if ($hours > 0) {
|
$hours = ($hours > 0) ? floor($hours) : ceil($hours);
|
||||||
$hours = floor($hours);
|
$mins = abs($deltaMin % 60);
|
||||||
} else {
|
|
||||||
$hours = ceil($hours);
|
|
||||||
}
|
|
||||||
|
|
||||||
$mins = abs($deltaMin%60);
|
|
||||||
|
|
||||||
//current timesamp in UTC.
|
//current timesamp in UTC.
|
||||||
$current_timestamp = gmdate("Y-m-d H:i:s");
|
$current_timestamp = gmdate("Y-m-d H:i:s");
|
||||||
|
|
||||||
//update all cc_show_instances that are in the future.
|
|
||||||
$sql = "UPDATE cc_show_instances
|
|
||||||
SET ends = (ends + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
|
|
||||||
WHERE (show_id = {$this->_showId} AND ends > '$current_timestamp')
|
|
||||||
AND ((ends + interval '{$deltaDay} days' + interval '{$hours}:{$mins}' - starts) <= interval '24:00');";
|
|
||||||
|
|
||||||
//update cc_show_days so future shows can be created with the new duration.
|
|
||||||
//only setting new duration if it is less than or equal to 24 hours.
|
|
||||||
$sql = $sql . "
|
|
||||||
UPDATE cc_show_days SET duration = (CAST(duration AS interval) + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
|
|
||||||
WHERE show_id = {$this->_showId}
|
|
||||||
AND ((CAST(duration AS interval) + interval '{$deltaDay} days' + interval '{$hours}:{$mins}') <= interval '24:00')";
|
|
||||||
|
|
||||||
$sql_gen = <<<SQL
|
$sql_gen = <<<SQL
|
||||||
UPDATE cc_show_instances
|
UPDATE cc_show_instances
|
||||||
SET ends = (ends + interval :deltaDay1 + interval :interval1)
|
SET ends = (ends + interval :deltaDay1 + interval :interval1)
|
||||||
|
@ -260,9 +241,6 @@ SQL;
|
||||||
':interval4' => "$hours:$mins"
|
':interval4' => "$hours:$mins"
|
||||||
), "execute");
|
), "execute");
|
||||||
|
|
||||||
//do both the queries at once.
|
|
||||||
//$con->exec($sql);
|
|
||||||
|
|
||||||
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||||
$con->beginTransaction();
|
$con->beginTransaction();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue