From 71282fb72f8d113953aef5eb7be111a14ece3f22 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 7 Oct 2013 11:06:01 +0200 Subject: Fix issue #169: flux en jaune si 0 article --- app/models/Feed.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'app/models/Feed.php') diff --git a/app/models/Feed.php b/app/models/Feed.php index 6f09bf844..02a4e6be7 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -4,6 +4,7 @@ class Feed extends Model { private $id = null; private $url; private $category = '000000'; + private $nbEntries = -1; private $nbNotRead = -1; private $entries = null; private $name = ''; @@ -79,12 +80,16 @@ class Feed extends Model { return $this->keep_history; } public function nbEntries () { - $feedDAO = new FeedDAO (); - return $feedDAO->countEntries ($this->id ()); + if ($this->nbEntries < 0) { + $feedDAO = new FeedDAO (); + $this->nbEntries = $feedDAO->countEntries ($this->id ()); + } + + return $this->nbEntries; } public function nbNotRead () { if ($this->nbNotRead < 0) { - $feedDAO = new FeedDAO (); + $feedDAO = new FeedDAO (); $this->nbNotRead = $feedDAO->countNotRead ($this->id ()); } -- cgit v1.2.3