Added bar chart

This commit is contained in:
Henry Whitaker
2020-07-22 13:38:32 +01:00
parent 0b5a4736e4
commit 4ab04f5264
7 changed files with 148045 additions and 55 deletions

View File

@@ -237,15 +237,10 @@ class SpeedtestHelper {
$success = Speedtest::select(DB::raw('COUNT(id) as rate'))->whereDate('created_at', $day)->where('failed', false)->get()[0]['rate'];
$fail = Speedtest::select(DB::raw('COUNT(id) as rate'))->whereDate('created_at', $day)->where('failed', true)->get()[0]['rate'];
if(( $success + $fail ) == 0) {
$percentage = 0;
} else {
$percentage = round(( $fail / ( $success + $fail ) * 100 ), 1);
}
array_push($rate, [
'date' => $day->toDateString(),
'rate' => $percentage
'success' => $success,
'failure' => $fail,
]);
}