Fix Last hour metric points. Closes #1482

This commit is contained in:
James Brooks
2016-02-20 19:39:07 +00:00
parent 207361d227
commit 58f755d136
2 changed files with 3 additions and 3 deletions

View File

@@ -33,8 +33,8 @@ class SqliteRepository implements MetricInterface
$hourInterval = $dateTime->format('YmdHi');
$points = $metric->points()
->whereRaw('strftime("%Y%m%d%H%i", created_at) = "'.$hourInterval.'"')
->groupBy(DB::raw('strftime("%H%i", created_at)'));
->whereRaw('strftime("%Y%m%d%H%M", created_at) = "'.$hourInterval.'"')
->groupBy(DB::raw('strftime("%H%M", created_at)'));
if (!isset($metric->calc_type) || $metric->calc_type == Metric::CALC_SUM) {
$value = $points->sum('value');