Fixed featuring the same post bumping counter

This commit is contained in:
Marcin Kurczewski 2014-10-25 18:28:15 +02:00
parent 3dbb2b06be
commit ef98e00b15

View file

@ -69,9 +69,12 @@ class PostFeatureService
{ {
$previousFeaturedPost = $this->getFeaturedPost(); $previousFeaturedPost = $this->getFeaturedPost();
$post->setLastFeatureTime($this->timeService->getCurrentTime()); if ($previousFeaturedPost->getId() !== $post->getId())
$post->setFeatureCount($post->getFeatureCount() + 1); {
$this->postDao->save($post); $post->setLastFeatureTime($this->timeService->getCurrentTime());
$post->setFeatureCount($post->getFeatureCount() + 1);
$this->postDao->save($post);
}
$globalParam = new GlobalParam(); $globalParam = new GlobalParam();
$globalParam->setKey(GlobalParam::KEY_FEATURED_POST); $globalParam->setKey(GlobalParam::KEY_FEATURED_POST);