diff --git a/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php b/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php index 91a07f49..ce34b149 100644 --- a/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php @@ -70,9 +70,8 @@ class AddMetricPointCommandHandler protected function findOrCreatePoint(AddMetricPointCommand $command) { $buffer = Carbon::now()->subMinutes($command->metric->threshold); - $point = MetricPoint::where('metric_id', '=', $command->metric->id)->where('value', '=', $command->value)->where('created_at', '>=', $buffer)->first(); - if ($point) { + if ($point = MetricPoint::where('metric_id', '=', $command->metric->id)->where('value', '=', $command->value)->where('created_at', '>=', $buffer)->first()) { return $point; }