From 4d8688f8e3c7b41caca0fefe4a8a3370ddaaadd7 Mon Sep 17 00:00:00 2001 From: Chris Mytton Date: Thu, 14 Dec 2023 10:33:06 +0000 Subject: [PATCH] [Brent][ATAK] Set external status code for closed reports We were already setting the FMS status code correctly, but were missing the external status code for reports that were automatically marked as closed, which was causing some warnings. --- conf/council-brent_atak.yml-example | 1 + perllib/Open311/Endpoint/Integration/ATAK.pm | 3 ++- t/open311/endpoint/brent.t | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/conf/council-brent_atak.yml-example b/conf/council-brent_atak.yml-example index 1eef3120d..96e50a45e 100644 --- a/conf/council-brent_atak.yml-example +++ b/conf/council-brent_atak.yml-example @@ -27,3 +27,4 @@ atak_status_to_fms_status: "Closed - Not found": "closed" "Closed - Passed to Brent": "internal_referral" fixed_status: "Closed - Completed" +closed_status: "Closed - Not found" diff --git a/perllib/Open311/Endpoint/Integration/ATAK.pm b/perllib/Open311/Endpoint/Integration/ATAK.pm index c1d1ff9ae..4b0cdef10 100644 --- a/perllib/Open311/Endpoint/Integration/ATAK.pm +++ b/perllib/Open311/Endpoint/Integration/ATAK.pm @@ -371,11 +371,12 @@ sub _fetch_and_apply_updated_issues_info { # Task comments field is present, not blank, but doesn't start with a known ATAK status. if (!$mapped_fms_status) { $self->logger->debug(sprintf( - "[ATAK] Updated issue %s has unmapped ATAK status '%s'. Skipping.", + "[ATAK] Updated issue %s has unmapped ATAK status '%s'. Defaulting to closed status.", $issue_reference, $task_comments )); $mapped_fms_status = 'closed'; + $atak_status = $self->endpoint_config->{closed_status}; } my $existing_tracking = $tracked_statuses->{issues}->{$issue_reference}; diff --git a/t/open311/endpoint/brent.t b/t/open311/endpoint/brent.t index 4083e234a..ebecb8776 100644 --- a/t/open311/endpoint/brent.t +++ b/t/open311/endpoint/brent.t @@ -88,6 +88,7 @@ sub atak_config { "Closed - Passed to Brent" => "internal_referral", }, fixed_status => "Closed - Completed", + closed_status => "Closed - Not found", } } @@ -916,6 +917,7 @@ subtest "GET ATAK service request updates OK" => sub { status => 'closed', update_id => 'ATAK-unknown_state_1690848000', updated_datetime => '2023-08-01T00:00:00Z', + external_status_code => 'Closed - Not found', } ] ); @@ -931,6 +933,16 @@ subtest "GET ATAK service request updates OK" => sub { # rather than the 'future' time. return HTTP::Response->new(200, 'OK', [], '{ "tasks": [ + { + "testing_comment": "same ATAK status - should ignore", + "client_ref": "unknown_state", + "task_comments": "Closed - Unknown", + "task_d_created": "2023-08-01T00:00:00Z", + "task_d_planned": "2023-08-01T00:00:00Z", + "task_d_completed": "2023-08-01T00:00:00Z", + "task_d_approved": "2023-08-01T00:00:00Z", + "task_p_id": "125" + }, { "testing_comment": "new update but same ATAK status - should ignore", "client_ref": "test", @@ -939,7 +951,7 @@ subtest "GET ATAK service request updates OK" => sub { "task_d_planned": "2023-08-02T01:00:00Z", "task_d_completed": "2023-08-02T02:00:00Z", "task_d_approved": "2023-08-04T03:00:00Z", - "task_p_id": "128" + "task_p_id": "127" } ] }'); @@ -977,6 +989,7 @@ subtest "GET ATAK service request updates OK" => sub { status => 'closed', update_id => 'ATAK-unknown_state_1690848000', updated_datetime => '2023-08-01T00:00:00Z', + external_status_code => 'Closed - Not found', } ] );