Slight refactor

This commit is contained in:
James Brooks 2016-11-25 20:07:49 +00:00
parent 39299829ab
commit fd9b1ffd5a

View File

@ -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;
}