From 82f2b2e7c33b7191aff07c105604d654ca72e98c Mon Sep 17 00:00:00 2001 From: denise Date: Fri, 24 Aug 2012 11:12:31 -0400 Subject: [PATCH] CC-4249: Playlist: Playlist's length doesn't update if it contains a smart playlist which the length is changed -fixed --- airtime_mvc/application/models/Block.php | 7 ++----- airtime_mvc/application/models/Playlist.php | 20 -------------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index 87b0bf524..62d152fd1 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -452,8 +452,7 @@ EOT; $this->con->commit(); - //check if block is in any playlists and update the playlist's length - Application_Model_Playlist::updatePlaylistsLengthWithBlock($this->id, $this->getLength()); + $this->updateBlockLengthInAllPlaylist(); } catch (Exception $e) { $this->con->rollback(); @@ -567,9 +566,7 @@ EOT; $this->con->commit(); - - //check if block is in any playlists and update the playlist's length - Application_Model_Playlist::updatePlaylistsLengthWithBlock($this->id, $this->getLength()); + $this->updateBlockLengthInAllPlaylist(); } catch (Exception $e) { $this->con->rollback(); diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index 17fc1907f..5d716b107 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -913,26 +913,6 @@ SQL; { CcPlaylistcontentsQuery::create()->findByDbPlaylistId($this->id)->delete(); } - - /** - * After items get deleted/added from/to a block - * this function updates the length of playlists - * that contain that block - */ - public static function updatePlaylistsLengthWithBlock($p_blockId, $p_blockLength) { - $playlists = CcPlaylistQuery::create()->find(); - foreach ($playlists as $pl) { - $contents = CcPlaylistcontentsQuery::create()->findByDbPlaylistId($pl->getDbId()); - //check if the block is in each playlist - foreach ($contents as $item) { - if ($item->getDbBlockId() == $p_blockId) { - $item->setDbCliplength($p_blockLength); - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME); - $item->save($con); - } - } - } - } } // class Playlist