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

Merge branch '1076-remove-data-between-five-minute-steps-for-count-script' into 'development'

Resolve "Remove Data between five minute steps for count script"

Closes #1076

See merge request !1774
parents e9c1aeda 285e50f7
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 ...@@ -142,11 +142,19 @@ class AdminInterface extends Controller
$rekordTagDate = ""; $rekordTagDate = "";
$size = 0; $size = 0;
$count = 0; $count = 0;
$logToday = 0;
foreach ($logs as $key => $stats) { foreach ($logs as $key => $stats) {
if ($key === 0) { if ($key === 0) {
// Log for today // 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; continue;
} }
$insgesamt = empty($stats->insgesamt->{$interface}) ? 0 : $stats->insgesamt->{$interface}; $insgesamt = empty($stats->insgesamt->{$interface}) ? 0 : $stats->insgesamt->{$interface};
...@@ -156,7 +164,7 @@ class AdminInterface extends Controller ...@@ -156,7 +164,7 @@ class AdminInterface extends Controller
$now->minute = 0; $now->minute = 0;
$now->second = 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}; $sameTime += empty($stats->time->{$now->format('H:i')}->{$interface}) ? 0 : $stats->time->{$now->format('H:i')}->{$interface};
$now->addMinutes(5); $now->addMinutes(5);
} }
...@@ -190,7 +198,7 @@ class AdminInterface extends Controller ...@@ -190,7 +198,7 @@ class AdminInterface extends Controller
$sum += ($logToday - $sameTime); $sum += ($logToday - $sameTime);
} }
} }
$averageIncrease = 0; $averageIncrease = 0;
if (sizeof($sameTimes) > 0) { if (sizeof($sameTimes) > 0) {
$averageIncrease = $sum / sizeof($sameTimes); $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