From 557bc2c3cd1fd2dddf1d7c03731aaaf173cd2bb7 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sat, 15 Nov 2014 21:55:42 -0500 Subject: Don't display analytics if not enough data --- app/Model/ProjectAnalytic.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/Model/ProjectAnalytic.php') diff --git a/app/Model/ProjectAnalytic.php b/app/Model/ProjectAnalytic.php index b62248eb..46f2242d 100644 --- a/app/Model/ProjectAnalytic.php +++ b/app/Model/ProjectAnalytic.php @@ -34,6 +34,10 @@ class ProjectAnalytic extends Base ); } + if ($total === 0) { + return array(); + } + foreach ($metrics as &$metric) { $metric['percentage'] = round(($metric['nb_tasks'] * 100) / $total, 2); } @@ -71,6 +75,10 @@ class ProjectAnalytic extends Base $metrics[$user]['nb_tasks']++; } + if ($total === 0) { + return array(); + } + foreach ($metrics as &$metric) { $metric['percentage'] = round(($metric['nb_tasks'] * 100) / $total, 2); } -- cgit v1.2.3