aboutsummaryrefslogtreecommitdiff
path: root/app/Models
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-13 01:00:27 -0400
commitef4961fe8570df97e19f70562837694f07062b2b (patch)
tree7f312bb01cacdefd0b4189ae65db2f18257081f2 /app/Models
parent1dab7402bc47a7992b7f868d587fcb14c579692b (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')
-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();