From 1c79f07baadd9872c18818c207571543f4290eab Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sat, 13 Apr 2019 13:08:32 +0100 Subject: [PATCH] Attempt fix of PgSQL metrics --- app/Repositories/Metric/PgSqlRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Repositories/Metric/PgSqlRepository.php b/app/Repositories/Metric/PgSqlRepository.php index 8374e0d9c..4d09e33af 100644 --- a/app/Repositories/Metric/PgSqlRepository.php +++ b/app/Repositories/Metric/PgSqlRepository.php @@ -38,7 +38,7 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac "AND {$this->getMetricPointsTable()}.created_at >= (NOW() - INTERVAL '{$minutes}' MINUTE) ". "AND {$this->getMetricPointsTable()}.created_at <= NOW() ". "GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:MI') ". - "ORDER BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:MI')", [ + "ORDER BY {$this->getMetricPointsTable()}.created_at", [ 'metricId' => $metric->id, ]); @@ -62,7 +62,7 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac "AND {$this->getMetricPointsTable()}.created_at >= (NOW() - INTERVAL '{$hour}' HOUR) ". "AND {$this->getMetricPointsTable()}.created_at <= NOW() ". "GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:00') ". - "ORDER BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:00')", [ + "ORDER BY {$this->getMetricPointsTable()}.created_at", [ 'metricId' => $metric->id, ]);