From ef98e00b1531cf3d05cdafdb38c978c059a417a0 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 25 Oct 2014 18:28:15 +0200 Subject: [PATCH] Fixed featuring the same post bumping counter --- src/Services/PostFeatureService.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Services/PostFeatureService.php b/src/Services/PostFeatureService.php index b8ee6ab6..c8014a39 100644 --- a/src/Services/PostFeatureService.php +++ b/src/Services/PostFeatureService.php @@ -69,9 +69,12 @@ class PostFeatureService { $previousFeaturedPost = $this->getFeaturedPost(); - $post->setLastFeatureTime($this->timeService->getCurrentTime()); - $post->setFeatureCount($post->getFeatureCount() + 1); - $this->postDao->save($post); + if ($previousFeaturedPost->getId() !== $post->getId()) + { + $post->setLastFeatureTime($this->timeService->getCurrentTime()); + $post->setFeatureCount($post->getFeatureCount() + 1); + $this->postDao->save($post); + } $globalParam = new GlobalParam(); $globalParam->setKey(GlobalParam::KEY_FEATURED_POST);