diff options
| author | 2014-07-23 00:24:00 +0200 | |
|---|---|---|
| committer | 2014-07-23 00:24:00 +0200 | |
| commit | e507256d0bdebd02cf1fcd6fe1477cbac0b6934e (patch) | |
| tree | 196c4b30767ba6a03f8199a6485b539ea988feca /app/Controllers/statsController.php | |
| parent | 72293427ac222dba03e88b2e34abc41e12a657c5 (diff) | |
Stats idle feed small bug
Some feeds were listed more than once. A bit more independent from the
SQL query.
https://github.com/marienfressinaud/FreshRSS/issues/544
Diffstat (limited to 'app/Controllers/statsController.php')
| -rw-r--r-- | app/Controllers/statsController.php | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index be58dd0eb..45d13e043 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -15,7 +15,13 @@ class FreshRSS_stats_Controller extends Minz_ActionController { public function idleAction() { $statsDAO = FreshRSS_Factory::createStatsDAO(); $feeds = $statsDAO->calculateFeedLastDate(); - $idleFeeds = array(); + $idleFeeds = array( + 'last_year' => array(), + 'last_6_month' => array(), + 'last_3_month' => array(), + 'last_month' => array(), + 'last_week' => array(), + ); $now = new \DateTime(); $feedDate = clone $now; $lastWeek = clone $now; @@ -34,24 +40,20 @@ class FreshRSS_stats_Controller extends Minz_ActionController { if ($feedDate >= $lastWeek) { continue; } - if ($feedDate < $lastWeek) { - $idleFeeds['last_week'][] = $feed; - } - if ($feedDate < $lastMonth) { - $idleFeeds['last_month'][] = $feed; - } - if ($feedDate < $last3Month) { - $idleFeeds['last_3_month'][] = $feed; - } - if ($feedDate < $last6Month) { - $idleFeeds['last_6_month'][] = $feed; - } if ($feedDate < $lastYear) { $idleFeeds['last_year'][] = $feed; + } elseif ($feedDate < $last6Month) { + $idleFeeds['last_6_month'][] = $feed; + } elseif ($feedDate < $last3Month) { + $idleFeeds['last_3_month'][] = $feed; + } elseif ($feedDate < $lastMonth) { + $idleFeeds['last_month'][] = $feed; + } elseif ($feedDate < $lastWeek) { + $idleFeeds['last_week'][] = $feed; } } - $this->view->idleFeeds = array_reverse($idleFeeds); + $this->view->idleFeeds = $idleFeeds; } public function firstAction() { |
