From 2ecfbee2495012e8a33151d9d07d184aeca892df Mon Sep 17 00:00:00 2001 From: Jake Kemme Date: Thu, 3 Sep 2020 14:54:34 -0400 Subject: [PATCH] Revert "Fixing issue #3842" This reverts commit 3b74cd05e8285ab640bd34b081a456d032ed8678. --- app/Repositories/Metric/MetricRepository.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/Repositories/Metric/MetricRepository.php b/app/Repositories/Metric/MetricRepository.php index c424336b19cd..a97c5abae368 100644 --- a/app/Repositories/Metric/MetricRepository.php +++ b/app/Repositories/Metric/MetricRepository.php @@ -65,23 +65,15 @@ public function listPointsLastHour(Metric $metric) $points = $this->repository->getPointsSinceMinutes($metric, $nrOfMinutes + $metric->threshold)->pluck('value', 'key')->take(-$nrOfMinutes); $timeframe = $nrOfMinutes; - - //Settings counter for minutes without data - $minutesWithNoData = 0; - for ($i = 0; $i < $timeframe; $i++) { if (!$points->has($pointKey)) { if ($i >= $metric->threshold) { $points->put($pointKey, $metric->default_value); - //We put default value as metric, so we can reset counter for minutes without data - $minutesWithNoData = 0; } else { - //We didn't find any data, but threshold is not meet yet so we just adding to counter - $minutesWithNoData++; + // The point not found is still within the threshold, so it is ignored and + // the timeframe is shifted by one minute + $timeframe++; } - } else { - //We found data within this threshold, zeroing counter - $minutesWithNoData = 0; } $pointKey = $dateTime->sub(new DateInterval('PT1M'))->format('Y-m-d H:i');