Skip to content

Commit

Permalink
Fixes #583, use 24H in PgSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrooksuk committed Apr 15, 2015
1 parent 7e1d0eb commit e0fd2db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Models/Metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function getValues($hour)
$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 = {$this->id} AND to_char(metric_points.created_at, 'YYYYMMDDHH') = :timestamp GROUP BY to_char(metric_points.created_at, 'H')", [
$query = DB::select("select {$queryType} as aggregate FROM metrics JOIN metric_points ON metric_points.metric_id = metrics.id WHERE metric_points.metric_id = {$this->id} AND to_char(metric_points.created_at, 'YYYYMMDDHH24') = :timestamp GROUP BY to_char(metric_points.created_at, 'H')", [
'timestamp' => $dateTime->sub(new DateInterval('PT'.$hour.'H'))->format('YmdH'),
]);

Expand Down

0 comments on commit e0fd2db

Please sign in to comment.