Skip to content
Snippets Groups Projects
Commit decf78db authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

stripping data of the time to the next 5 minutes

parent 4447272a
No related branches found
No related tags found
3 merge requests!1895Development,!1775Development,!1774Resolve "Remove Data between five minute steps for count script"
......@@ -142,11 +142,19 @@ class AdminInterface extends Controller
$rekordTagDate = "";
$size = 0;
$count = 0;
$logToday = 0;
foreach ($logs as $key => $stats) {
if ($key === 0) {
// Log for today
$logToday = empty($stats->insgesamt->{$interface}) ? 0 : $stats->insgesamt->{$interface};
$now = Carbon::now();
$now->hour = 0;
$now->minute = 0;
$now->second = 0;
while ($now->lessThanOrEqualTo(Carbon::now()->subMinutes(5))) {
$logToday += empty($stats->time->{$now->format('H:i')}->{$interface}) ? 0 : $stats->time->{$now->format('H:i')}->{$interface};
$now->addMinutes(5);
}
continue;
}
$insgesamt = empty($stats->insgesamt->{$interface}) ? 0 : $stats->insgesamt->{$interface};
......@@ -156,7 +164,7 @@ class AdminInterface extends Controller
$now->minute = 0;
$now->second = 0;
while ($now->lessThanOrEqualTo(Carbon::now())) {
while ($now->lessThanOrEqualTo(Carbon::now()->subMinutes(5))) {
$sameTime += empty($stats->time->{$now->format('H:i')}->{$interface}) ? 0 : $stats->time->{$now->format('H:i')}->{$interface};
$now->addMinutes(5);
}
......@@ -190,7 +198,7 @@ class AdminInterface extends Controller
$sum += ($logToday - $sameTime);
}
}
$averageIncrease = 0;
if (sizeof($sameTimes) > 0) {
$averageIncrease = $sum / sizeof($sameTimes);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment