aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Dashboard.pm6
-rw-r--r--t/app/controller/dashboard.t32
2 files changed, 36 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm
index 11792ed9f..b52e682a5 100644
--- a/perllib/FixMyStreet/App/Controller/Dashboard.pm
+++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm
@@ -138,6 +138,8 @@ sub index : Path : Args(0) {
$prob_where->{state} = [ FixMyStreet::DB::Result::Problem->fixed_states() ];
} elsif ( $c->stash->{q_state} ) {
$prob_where->{state} = $c->stash->{q_state};
+ $prob_where->{state} = { IN => [ 'planned', 'action scheduled' ] }
+ if $prob_where->{state} eq 'action scheduled';
}
my $params = {
%$prob_where,
@@ -181,7 +183,9 @@ sub updates_search : Private {
map { $_ => $counts{$_} || 0 }
('confirmed', 'investigating', 'in progress', 'closed', 'fixed - council',
'fixed - user', 'fixed', 'unconfirmed', 'hidden',
- 'partial', 'action scheduled');
+ 'partial', 'action scheduled', 'planned');
+
+ $counts{'action scheduled'} += $counts{planned} || 0;
for my $vars (
[ 'time_to_fix', 'fixed - council' ],
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t
index ffdc5e5b3..25e144464 100644
--- a/t/app/controller/dashboard.t
+++ b/t/app/controller/dashboard.t
@@ -318,6 +318,25 @@ foreach my $test (
marked => [5,5,5,5]
}
},
+ {
+ desc => 'marked as planned',
+ confirm_dt => DateTime->now->subtract( days => 1 ),
+ mark_dt => DateTime->now,
+ state => 'planned',
+ counts => {
+ totals => $is_monday ? [0,7,10,11] : [7,7,10,11],
+ user => [1,1,1,2],
+ council => [2,2,3,3],
+ total_fixed => [3,3,4,5],
+ avg_fixed => [5,5,7,7],
+ avg_marked => [2,2,2,2],
+ investigating => [1,1,1,1],
+ in_progress => [1,1,1,1],
+ action_scheduled => [3,3,3,3],
+ closed => [1,1,1,1],
+ marked => [6,6,6,6]
+ }
+ },
) {
subtest $test->{desc} => sub {
make_problem(
@@ -528,6 +547,17 @@ for my $test (
report_counts_after => [1,0,0],
},
{
+ desc => 'planned counted as action scheduled',
+ p1 => {
+ state => 'planned',
+ conf_dt => DateTime->now(),
+ category => 'Potholes',
+ },
+ state => 'action scheduled',
+ report_counts => [3,0,0],
+ report_counts_after => [1,0,0],
+ },
+ {
desc => 'All fixed states count as fixed',
p1 => {
state => 'fixed - council',
@@ -540,7 +570,7 @@ for my $test (
category => 'Potholes',
},
state => 'fixed',
- report_counts => [4,0,0],
+ report_counts => [5,0,0],
report_counts_after => [3,0,0],
},
) {