diff options
author | Struan Donald <struan@exo.org.uk> | 2017-09-22 17:28:04 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2017-10-04 11:13:10 +0100 |
commit | 2c083bab1fab506a06f27561a5e17408f4b0b723 (patch) | |
tree | af494713de1e7484d9eaf0ecbb8d6780b72f830c /perllib/FixMyStreet/App/Controller | |
parent | b243fc8ae7ef3b892ec94b744ca0c3332a6931a6 (diff) |
correctly handle average state changes of 0 days in area stats
If no problems have changed status then set the average to -1 so we can
cope with an average status change of 0 days.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/AreaStats.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/AreaStats.pm b/perllib/FixMyStreet/App/Controller/Admin/AreaStats.pm index 2357e0025..2058ea872 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/AreaStats.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/AreaStats.pm @@ -207,7 +207,12 @@ sub stats : Private { join => 'problem' } )->first; - $c->stash->{average} = int( ($comments->get_column('time')||0)/ 60 / 60 / 24 + 0.5 ); + my $raw_average = $comments->get_column('time'); + if (defined $raw_average) { + $c->stash->{average} = int( $raw_average / 60 / 60 / 24 + 0.5 ); + } else { + $c->stash->{average} = -1; + } } sub load_user_body : Private { |