Merge branch '2.1' into merge

# Conflicts:
#	composer.json
#	composer.lock
This commit is contained in:
Graham Campbell
2016-02-20 21:14:25 +00:00
178 changed files with 2465 additions and 2497 deletions
@@ -69,7 +69,7 @@ class ReportIncidentCommandHandler
// The incident occurred at a different time.
if ($command->incident_date) {
$incidentDate = $this->dates->createNormalized('d/m/Y H:i', $command->incident_date);
$incidentDate = $this->dates->create('d/m/Y H:i', $command->incident_date);
$data['created_at'] = $incidentDate;
$data['updated_at'] = $incidentDate;
@@ -46,7 +46,7 @@ class ReportMaintenanceCommandHandler
*/
public function handle(ReportMaintenanceCommand $command)
{
$scheduledAt = $this->dates->createNormalized('d/m/Y H:i', $command->timestamp);
$scheduledAt = $this->dates->create('d/m/Y H:i', $command->timestamp);
$maintenanceEvent = Incident::create([
'name' => $command->name,
@@ -59,7 +59,7 @@ class UpdateIncidentCommandHandler
// The incident occurred at a different time.
if ($command->incident_date) {
$incidentDate = $this->dates->createNormalized('d/m/Y H:i', $command->incident_date);
$incidentDate = $this->dates->create('d/m/Y H:i', $command->incident_date);
$incident->update([
'created_at' => $incidentDate,
+1 -1
View File
@@ -41,7 +41,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 metrics.id = :metric_id AND to_char(metric_points.created_at, 'YYYYMMDDHHMI') = :timestamp GROUP BY to_char(metric_points.created_at, 'HHMI')", [
$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, 'YYYYMMDDHH24MI') = :timestamp GROUP BY to_char(metric_points.created_at, 'HHMI')", [
'metric_id' => $metric->id,
'timestamp' => $hourInterval,
]);
+2 -2
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');