partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 9ed81c53c796c2513ca4f671ee5f0a7bd14c1659
parent 905dfd256de8c2731b07418a5aabc18bc44f9489
Author: Felicitus <felicitus@felicitus.org>
Date:   Sun, 11 Sep 2011 10:00:46 +0200

Added call to return the start/end dates for the statistic snapshots

Diffstat:
Msrc/de/RaumZeitLabor/PartKeepr/Statistic/StatisticService.php | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/de/RaumZeitLabor/PartKeepr/Statistic/StatisticService.php b/src/de/RaumZeitLabor/PartKeepr/Statistic/StatisticService.php @@ -35,6 +35,18 @@ class StatisticService extends Service { } /** + * Returns the range of all recorded statistic snapshots. + */ + public function getStatisticRange () { + $dql = "SELECT MIN(sts.dateTime), MAX(sts.dateTime) FROM de\RaumZeitLabor\PartKeepr\Statistic\StatisticSnapshot sts"; + $query = PartKeepr::getEM()->createQuery($dql); + + $data = $query->getArrayResult(); + + return array("data" => array("start" => $data[0][1], "end" => $data[0][2])); + + } + /** * Returns sampled statistics from the database. * * This call takes a start and an end time, and calculates a set of statistics