Merge pull request #2998 from JordyvanDortmont/2.4

Fix metric point counting within threshold
This commit is contained in:
James Brooks
2018-04-23 22:23:36 +01:00
committed by GitHub

View File

@@ -79,7 +79,7 @@ class CreateMetricPointCommandHandler
*/
protected function findOrCreatePoint(CreateMetricPointCommand $command)
{
$buffer = Carbon::now()->subMinutes($command->metric->threshold);
$buffer = Carbon::now()->subMinutes($command->metric->threshold - 1)->startOfMinute();
if ($point = MetricPoint::where('metric_id', '=', $command->metric->id)->where('value', '=', $command->value)->where('created_at', '>=', $buffer)->first()) {
return $point;