aboutsummaryrefslogtreecommitdiff
path: root/app/Models/StatsDAO.php
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <github@ainw.org> 2014-06-13 01:00:27 -0400
committerGravatar Alexis Degrugillier <github@ainw.org> 2014-06-15 12:05:21 -0400
commit181fcd98893f65a2c5159158fbfc022b4661ea13 (patch)
tree62769146e342a71e3f3f5b49232061a613e23f4c /app/Models/StatsDAO.php
parent09602acc5f754c3e814b4b7de9d9d4d283ed45ff (diff)
Refactor statistics
I made a new controller to handle statistics. The old statistics have been moved in that controller and a new action has been added to display idle feeds. I also added a menu in the left panel to navigate between the statistics pages. See #90
Diffstat (limited to 'app/Models/StatsDAO.php')
-rw-r--r--app/Models/StatsDAO.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php
index 60cec7847..f9f4740fd 100644
--- a/app/Models/StatsDAO.php
+++ b/app/Models/StatsDAO.php
@@ -180,6 +180,26 @@ SQL;
$stm->execute();
return $stm->fetchAll(PDO::FETCH_ASSOC);
}
+
+ /**
+ * Calculates the last publication date for each feed
+ *
+ * @return array
+ */
+ public function calculateFeedLastDate() {
+ $sql = <<<SQL
+SELECT MAX(f.name) AS name
+, MAX(date) AS last_date
+FROM {$this->prefix}feed AS f,
+{$this->prefix}entry AS e
+WHERE f.id = e.id_feed
+GROUP BY f.id
+ORDER BY name
+SQL;
+ $stm = $this->bd->prepare($sql);
+ $stm->execute();
+ return $stm->fetchAll(PDO::FETCH_ASSOC);
+ }
private function convertToSerie($data) {
$serie = array();