CC-4321: NowPlaying: Cancelling Webstream has no effect and results in OnAir being grayed out

-fixed
This commit is contained in:
Martin Konecny 2012-08-31 12:18:37 -04:00
parent 79b6d13c16
commit c043053407
3 changed files with 43 additions and 32 deletions

View file

@ -24,7 +24,11 @@ class Application_Model_Scheduler
{
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
$this->epochNow = microtime(true);
//subtracting one because sometimes when we cancel a track, we set its end time
//to epochNow and then send the new schedule to pypo. Sometimes the currently cancelled
//track can still be included in the new schedule because it may have a few ms left to play.
//subtracting 1 second from epochNow resolves this issue.
$this->epochNow = microtime(true)-1;
$this->nowDT = DateTime::createFromFormat("U.u", $this->epochNow, new DateTimeZone("UTC"));
if ($this->nowDT === false) {
@ -324,6 +328,8 @@ class Application_Model_Scheduler
* @param int $showInstance
* @param array $exclude
* ids of sched items to remove from the calulation.
* This function squeezes all items of a show together so that
* there are no gaps between them.
*/
private function removeGaps($showInstance, $exclude=null)
{
@ -665,7 +671,7 @@ class Application_Model_Scheduler
//playing.
$removedItem->setDbCueOut($cueout)
->setDbClipLength($cliplength)
->setDbEnds($this->nowDT->sub(new DateInteval("PT1S")))
->setDbEnds($this->nowDT)
->save($this->con);
} else {
$removedItem->delete($this->con);