[Isocial-svn] SF.net SVN: isocial: [216]
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <fsn...@us...> - 2008-05-21 18:34:34
|
Revision: 216 http://isocial.svn.sourceforge.net/isocial/?rev=216&view=rev Author: fsnobody Date: 2008-05-21 11:34:38 -0700 (Wed, 21 May 2008) Log Message: ----------- in triggers leave only counters Modified Paths: -------------- app/controllers/photoapp/album_controller.php app/installers/photoapp/album_installer.php timesheet/eerunov.txt Modified: app/controllers/photoapp/album_controller.php =================================================================== --- app/controllers/photoapp/album_controller.php 2008-05-21 17:24:33 UTC (rev 215) +++ app/controllers/photoapp/album_controller.php 2008-05-21 18:34:38 UTC (rev 216) @@ -30,6 +30,7 @@ $photo->setAttributes($this->params['photo']); if ($this->Request->isPost() && $photo->save()){ if ($photo->is_cover == 1) { + $album = $this->PhotoappAlbum->findFirst(array('id' => $photo->album_id)); $album->img = $photo->img; $album->save(); } // set cover if needed @@ -186,6 +187,8 @@ if( empty($album->img)) { $photo->is_cover = 1; $album->img = $photo->img; + $photo->is_cover = 1; + $photo->save(); } //$album->photos_count += 1; $album->save(); Modified: app/installers/photoapp/album_installer.php =================================================================== --- app/installers/photoapp/album_installer.php 2008-05-21 17:24:33 UTC (rev 215) +++ app/installers/photoapp/album_installer.php 2008-05-21 18:34:38 UTC (rev 216) @@ -46,7 +46,19 @@ END; "); + $this->execute( + "CREATE TRIGGER papp_photo_update AFTER UPDATE ON photoapp_photos + FOR EACH ROW BEGIN + IF OLD.album_id != NEW.album_id THEN + UPDATE `photoapp_albums` SET photos_count = photos_count - 1 WHERE id = OLD.album_id; + UPDATE `photoapp_albums` SET photos_count = photos_count + 1 WHERE id = NEW.album_id; + END IF; + + END; + "); + + } Modified: timesheet/eerunov.txt =================================================================== --- timesheet/eerunov.txt 2008-05-21 17:24:33 UTC (rev 215) +++ timesheet/eerunov.txt 2008-05-21 18:34:38 UTC (rev 216) @@ -13,4 +13,5 @@ 2008-05-13,07:00,09:10,photoapp,RT:2,"photo list + delete" 2008-05-14,09:00,11:00.photoapp,RT:2,"change img storage + design edit photo v1" 2008-05-15,10:00,11:00,photoapp,RT:2,"edit photo" -2008-05-20,18:00,19:00,photoaoo,RT:2,"edit photo - save cover to album,trouble in destroyPhoto when it is cover" +2008-05-20,18:00,19:00,photoapp,RT:2,"edit photo - save cover to album,trouble in destroyPhoto when it is cover" +2008-05-21,18:30,21:20,photoapp,RT:2,"cover + triggers for photos_count in album" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |