From 82ab102ec74a26acf7e2e39a17a3934fb261aa52 Mon Sep 17 00:00:00 2001 From: Vincent BRIDIER Date: Tue, 1 Dec 2020 12:46:56 +0100 Subject: [PATCH] - Fix division by 0 --- app/Http/Controllers/bo/DashboardController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/bo/DashboardController.php b/app/Http/Controllers/bo/DashboardController.php index 643d087..440521a 100644 --- a/app/Http/Controllers/bo/DashboardController.php +++ b/app/Http/Controllers/bo/DashboardController.php @@ -26,7 +26,11 @@ class DashboardController extends Controller // Données calculées à afficher $totalParticipation = Participation::count(); - $avgParticipUser = round($totalParticipation / count($participationsUnique), 1); + if (count($participationsUnique) > 0){ + $avgParticipUser = round($totalParticipation / count($participationsUnique), 1); + } else { + $avgParticipUser = 0; + } // Tableau des dates comprises dans la table participation foreach ($participations as $participation)