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 /t/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 't/app/controller')
-rw-r--r-- | t/app/controller/area_stats.t | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/app/controller/area_stats.t b/t/app/controller/area_stats.t index 36e532c0e..ce2e3d7d6 100644 --- a/t/app/controller/area_stats.t +++ b/t/app/controller/area_stats.t @@ -98,6 +98,8 @@ FixMyStreet::override_config { $mech->text_contains('Potholes6'); $mech->text_contains('Traffic lights13'); + + $mech->text_contains('average time between issue being opened and set to another status was 0 days'); }; subtest 'shows correct stats to area user' => sub { @@ -212,6 +214,16 @@ FixMyStreet::override_config { $mech->get_ok("/admin/areastats/$body_id?area=20720"); $mech->text_contains('average time between issue being opened and set to another status was 4 days'); }; + + subtest 'shows no problems changed state if no average' => sub { + for my $p (@scheduled_problems, @fixed_problems, @closed_problems) { + $p->comments->delete; + } + + $mech->get_ok("/admin/areastats/$body_id?area=20720"); + $mech->text_contains('17 opened, 0 scheduled, 0 closed, 0 fixed'); + $mech->text_contains('no problems changed state'); + } }; END { |