diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | perllib/Open311.pm | 2 | ||||
-rw-r--r-- | perllib/Open311/GetServiceRequestUpdates.pm | 7 | ||||
-rw-r--r-- | t/open311/getservicerequestupdates.t | 14 |
4 files changed, 20 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 84653653b..c94357485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ - Remove small border to left of Fixed banner. #2156 - Fix issue displaying admin timeline. #2159 - Send details of unresponsive bodies to mobile app #2164 + - Open311 improvements: + - CLOSED status maps to 'closed' state if extended statuses are enabled. * v2.3.4 (7th June 2018) - Bugfixes: diff --git a/perllib/Open311.pm b/perllib/Open311.pm index a91de0a7c..a57fceeaf 100644 --- a/perllib/Open311.pm +++ b/perllib/Open311.pm @@ -327,7 +327,7 @@ sub map_state { 'not councils responsibility' => 'not responsible', 'no further action' => 'unable to fix', open => 'confirmed', - closed => 'fixed - council', + closed => $self->extended_statuses ? 'closed' : 'fixed - council', ); return $state_map{$incoming_state} || $incoming_state; diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index 7cbfc7192..4b1642506 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -32,9 +32,10 @@ sub fetch { while ( my $body = $bodies->next ) { my $o = Open311->new( - endpoint => $body->endpoint, - api_key => $body->api_key, - jurisdiction => $body->jurisdiction, + endpoint => $body->endpoint, + api_key => $body->api_key, + jurisdiction => $body->jurisdiction, + extended_statuses => $body->send_extended_statuses, ); # custom endpoint URLs because these councils have non-standard paths diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t index 3c279d776..27064574b 100644 --- a/t/open311/getservicerequestupdates.t +++ b/t/open311/getservicerequestupdates.t @@ -258,6 +258,18 @@ for my $test ( end_state => 'fixed - council', }, { + desc => 'status of CLOSED marks report as closed when using extended statuses', + description => 'This is a note', + external_id => 638344, + start_state => 'confirmed', + comment_status => 'CLOSED', + mark_fixed=> 0, + mark_open => 0, + problem_state => 'closed', + end_state => 'closed', + extended_statuses => 1, + }, + { desc => 'status of OPEN re-opens fixed report', description => 'This is a note', external_id => 638344, @@ -384,7 +396,7 @@ for my $test ( ) { subtest $test->{desc} => sub { my $local_requests_xml = setup_xml($problem->external_id, $problem->id, $test->{comment_status}, $test->{xml_description}); - my $o = Open311->new( jurisdiction => 'mysociety', endpoint => 'http://example.com', test_mode => 1, test_get_returns => { 'servicerequestupdates.xml' => $local_requests_xml } ); + my $o = Open311->new( jurisdiction => 'mysociety', endpoint => 'http://example.com', extended_statuses => $test->{extended_statuses}, test_mode => 1, test_get_returns => { 'servicerequestupdates.xml' => $local_requests_xml } ); $problem->lastupdate( DateTime->now()->subtract( days => 1 ) ); $problem->state( $test->{start_state} ); |