Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Revert "Fixing issue to be able to have mterics work for recommended …
Browse files Browse the repository at this point in the history
…docker / postgresql setup"

This reverts commit cfc2e1f.
  • Loading branch information
jdkemme committed Sep 3, 2020
1 parent 5522aa3 commit 234823d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/Repositories/Metric/PgSqlRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public function getPointsSinceMinutes(Metric $metric, $minutes)
"WHERE {$this->getMetricsTable()}.id = :metricId ".
"AND {$this->getMetricPointsTable()}.created_at >= (NOW() - INTERVAL '{$minutes}' MINUTE) ".
"AND {$this->getMetricPointsTable()}.created_at <= NOW() ".
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:MI') ".
"ORDER BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:MI')", [
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:MI') ".
"ORDER BY {$this->getMetricPointsTable()}.created_at", [
'metricId' => $metric->id,
]);

Expand All @@ -61,8 +61,8 @@ public function getPointsSinceHour(Metric $metric, $hour)
"WHERE {$this->getMetricsTable()}.id = :metricId ".
"AND {$this->getMetricPointsTable()}.created_at >= (NOW() - INTERVAL '{$hour}' HOUR) ".
"AND {$this->getMetricPointsTable()}.created_at <= NOW() ".
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:00') ".
"ORDER BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:00')", [
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:00') ".
"ORDER BY {$this->getMetricPointsTable()}.created_at", [
'metricId' => $metric->id,
]);

Expand All @@ -80,13 +80,13 @@ public function getPointsSinceHour(Metric $metric, $hour)
public function getPointsSinceDay(Metric $metric, $day)
{
$queryType = $this->getQueryType($metric);
$points = DB::select("SELECT to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:00') AS key, {$queryType} ".
$points = DB::select("SELECT DATE({$this->getMetricPointsTable()}.created_at) AS key, {$queryType} ".
"FROM {$this->getMetricsTable()} INNER JOIN {$this->getMetricPointsTable()} ON {$this->getMetricsTable()}.id = {$this->getMetricPointsTable()}.metric_id ".
"WHERE {$this->getMetricsTable()}.id = :metricId ".
"AND {$this->getMetricPointsTable()}.created_at >= (DATE(NOW()) - INTERVAL '{$day}' DAY) ".
"AND {$this->getMetricPointsTable()}.created_at <= DATE(NOW()) ".
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:00')".
"ORDER BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:00')", [
"GROUP BY DATE({$this->getMetricPointsTable()}.created_at) ".
"ORDER BY DATE({$this->getMetricPointsTable()}.created_at)", [
'metricId' => $metric->id,
]);

Expand Down

0 comments on commit 234823d

Please sign in to comment.