aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm2
-rw-r--r--perllib/Open311.pm2
-rw-r--r--perllib/Open311/GetServiceRequestUpdates.pm12
-rw-r--r--t/open311.t2
-rw-r--r--t/open311/getservicerequestupdates.t20
5 files changed, 24 insertions, 14 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 376190aff..83939bfab 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -309,7 +309,7 @@ HASHREF.
=cut
sub council_states {
my $states = {
- 'confirmed' => 1,
+ 'confirmed' => 1,
'investigating' => 1,
'action scheduled' => 1,
'in progress' => 1,
diff --git a/perllib/Open311.pm b/perllib/Open311.pm
index b508a2bcc..34a9b1bfb 100644
--- a/perllib/Open311.pm
+++ b/perllib/Open311.pm
@@ -291,7 +291,7 @@ sub _populate_service_request_update_params {
} elsif ( $comment->problem->state eq 'not responsible' ) {
$status = 'NOT_COUNCILS_RESPONSIBILITY';
} elsif ( $comment->problem->state eq 'unable to fix' ) {
- $status = 'UNABLE_TO_FIX';
+ $status = 'NO_FURTHER_ACTION';
}
} else {
$status = $comment->problem->is_open ? 'OPEN' : 'CLOSED',;
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm
index c0b9dcac0..99e1d5758 100644
--- a/perllib/Open311/GetServiceRequestUpdates.pm
+++ b/perllib/Open311/GetServiceRequestUpdates.pm
@@ -98,15 +98,12 @@ sub update_comments {
if ( $comment->created_local > $p->lastupdate_local ) {
my $state = $self->map_state( $request->{status} );
- # do not change a fixed problem to a closed one
- if ( $p->is_fixed && FixMyStreet::DB::Result::Problem->open_states()->{$state} ) {
+ # don't update state unless it's an allowed state and it's
+ # actually changing the state of the problem
+ if ( FixMyStreet::DB::Result::Problem->council_states()->{$state} && $p->state ne $state &&
+ !( $p->is_fixed && FixMyStreet::DB::Result::Problem->fixed_states()->{$state} ) ) {
$p->state($state);
$comment->problem_state($state);
- } elsif ( ( $p->is_open || $p->is_closed ) && $p->state ne $state ) {
- if ( FixMyStreet::DB::Result::Problem->council_states() ->{$state} ) {
- $p->state($state);
- $comment->problem_state($state);
- }
}
}
@@ -144,6 +141,7 @@ sub map_state {
my %state_map = (
fixed => 'fixed - council',
'not councils responsibility' => 'not responsible',
+ 'no further action' => 'unable to fix',
open => 'confirmed',
closed => 'fixed - council'
);
diff --git a/t/open311.t b/t/open311.t
index 82a6b420f..e897d3524 100644
--- a/t/open311.t
+++ b/t/open311.t
@@ -273,7 +273,7 @@ foreach my $test (
state => 'unable to fix',
anon => 0,
status => 'CLOSED',
- extended => 'UNABLE_TO_FIX',
+ extended => 'NO_FURTHER_ACTION',
},
{
desc => 'comment with closed state sends status of CLOSED',
diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t
index 680ea930c..9852e53b6 100644
--- a/t/open311/getservicerequestupdates.t
+++ b/t/open311/getservicerequestupdates.t
@@ -262,16 +262,28 @@ for my $test (
end_state => 'fixed - user',
},
{
- desc => 'closed status leaves fixed report as fixed',
+ desc => 'closed status updates fixed report',
updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
description => 'This is a note',
external_id => 638344,
start_state => 'fixed - user',
- comment_status => 'UNABLE_TO_FIX',
+ comment_status => 'NO_FURTHER_ACTION',
mark_fixed => 0,
mark_open => 0,
- problem_state => undef,
- end_state => 'fixed - user',
+ problem_state => 'unable to fix',
+ end_state => 'unable to fix',
+ },
+ {
+ desc => 'no futher action status closes report',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'confirmed',
+ comment_status => 'NO_FURTHER_ACTION',
+ mark_fixed => 0,
+ mark_open => 0,
+ problem_state => 'unable to fix',
+ end_state => 'unable to fix',
},
{
desc => 'fixed status sets closed report as fixed',