From 6d97c2e3ee1b168dc02491475b371c3983c0038a Mon Sep 17 00:00:00 2001 From: James Brooks Date: Wed, 20 Jan 2016 09:13:15 +0000 Subject: [PATCH] Fixes #1354 Postgres Last Hour Metrics --- app/Repositories/Metric/PgSqlRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Repositories/Metric/PgSqlRepository.php b/app/Repositories/Metric/PgSqlRepository.php index f54d32026..adaa43f62 100644 --- a/app/Repositories/Metric/PgSqlRepository.php +++ b/app/Repositories/Metric/PgSqlRepository.php @@ -60,7 +60,7 @@ class PgSqlRepository implements MetricInterface $queryType = 'sum(metric_points.value)'; } - $query = DB::select("select {$queryType} as aggregate FROM metrics JOIN metric_points ON metric_points.metric_id = metrics.id WHERE metric_points.metric_id = :metric_id AND to_char(metric_points.created_at, 'YYYYMMDDHHMI24') = :timestamp GROUP BY to_char(metric_points.created_at, 'HI')", [ + $query = DB::select("select {$queryType} as aggregate FROM metrics JOIN metric_points ON metric_points.metric_id = metrics.id WHERE metrics.id = :metric_id AND to_char(metric_points.created_at, 'YYYYMMDDHHMI') = :timestamp GROUP BY to_char(metric_points.created_at, 'HHMI')", [ 'metric_id' => $metric->id, 'timestamp' => $hourInterval, ]);