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 +++++++ app/Template/analytic/tasks.php | 51 ++++++++++++++++++++++------------------- app/Template/analytic/users.php | 51 ++++++++++++++++++++++------------------- 3 files changed, 64 insertions(+), 46 deletions(-) (limited to 'app') 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); } diff --git a/app/Template/analytic/tasks.php b/app/Template/analytic/tasks.php index 7ae9c254..01338d2e 100644 --- a/app/Template/analytic/tasks.php +++ b/app/Template/analytic/tasks.php @@ -1,29 +1,34 @@ -
-
+ +

+ +
- - - - - - - - - - - - - -
- - - - - % -
+
-
+ + + + + + + + + + + + + +
+ + + + + % +
+ +
+ diff --git a/app/Template/analytic/users.php b/app/Template/analytic/users.php index 89f00686..28e2fbbc 100644 --- a/app/Template/analytic/users.php +++ b/app/Template/analytic/users.php @@ -1,29 +1,34 @@ -
-
+ +

+ +
- - - - - - - - - - - - - -
- - - - - % -
+
-
+ + + + + + + + + + + + + +
+ + + + + % +
+ +
+ -- cgit v1.2.3