diff options
| author | 2014-07-31 17:21:09 +0200 | |
|---|---|---|
| committer | 2014-07-31 17:21:09 +0200 | |
| commit | aafcd3a879225414ca7fb5a9b74ba06e5ece8c12 (patch) | |
| tree | a263cd8d3378b31539ad2138771d82829f2e76f3 /app/Models/StatsDAOSQLite.php | |
| parent | 3ffa2e301850154c6d7959f70dbbd37dc7fbffc9 (diff) | |
| parent | 4a0e5ac037dc3c8fd16ca086924087f8ccaed46b (diff) | |
Merge branch 'dev' of github.com:marienfressinaud/freshrss into dev
Diffstat (limited to 'app/Models/StatsDAOSQLite.php')
| -rw-r--r-- | app/Models/StatsDAOSQLite.php | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/app/Models/StatsDAOSQLite.php b/app/Models/StatsDAOSQLite.php index dea590c92..6cb54ddf6 100644 --- a/app/Models/StatsDAOSQLite.php +++ b/app/Models/StatsDAOSQLite.php @@ -28,10 +28,36 @@ SQL; $res = $stm->fetchAll(PDO::FETCH_ASSOC); foreach ($res as $value) { - $count[(int)$value['day']] = (int) $value['count']; + $count[(int) $value['day']] = (int) $value['count']; } return $this->convertToSerie($count); } + protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) { + if ($feed) { + $restrict = "WHERE e.id_feed = {$feed}"; + } else { + $restrict = ''; + } + $sql = <<<SQL +SELECT strftime('{$period}', e.date, 'unixepoch') AS period +, COUNT(1) AS count +FROM {$this->prefix}entry AS e +{$restrict} +GROUP BY period +ORDER BY period ASC +SQL; + + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_NAMED); + + foreach ($res as $value) { + $repartition[(int) $value['period']] = (int) $value['count']; + } + + return $this->convertToSerie($repartition); + } + } |
