Fixing history

This commit is contained in:
Axel 2021-12-27 23:37:15 +01:00
parent 3852ef2945
commit f20adb7f28

View file

@ -98,6 +98,8 @@ class ApiController extends Controller
// Then we populate the stats data // Then we populate the stats data
$prev = null; $prev = null;
if (! is_null($history)) { if (! is_null($history)) {
$history = $history->reverse();
foreach ($history as $k => $r) { foreach ($history as $k => $r) {
if (empty($stats['uptime'][$r->date])) { if (empty($stats['uptime'][$r->date])) {
$stats['uptime'][$r->date] = [ $stats['uptime'][$r->date] = [
@ -116,9 +118,6 @@ class ApiController extends Controller
// Populating the response times // Populating the response times
if ($r->status == 1) { if ($r->status == 1) {
// array_push($stats['times'][$r->date], [
// 'durations' => $r->duration
// ]);
$stats['times'][$r->date]['duration'] += $r->duration; $stats['times'][$r->date]['duration'] += $r->duration;
$stats['times'][$r->date]['count'] ++; $stats['times'][$r->date]['count'] ++;
} }