Skip to content

Commit 9c72968

Browse files
committed
Merge branch 'brent-atak-add-planned-status' into staging
2 parents 088c74f + b7fb58e commit 9c72968

File tree

3 files changed

+46
-10
lines changed

3 files changed

+46
-10
lines changed

conf/council-brent_atak.yml-example

+2
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ atak_status_to_fms_status:
2626
"Closed - Out of scope": "no_further_action"
2727
"Closed - Not found": "closed"
2828
"Closed - Passed to Brent": "internal_referral"
29+
"In progress": "action_scheduled"
2930
fixed_status: "Closed - Completed"
3031
closed_status: "Closed - Not found"
32+
planned_status: "In progress"

perllib/Open311/Endpoint/Integration/ATAK.pm

+16-8
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,11 @@ sub _fetch_and_apply_updated_issues_info {
333333
next;
334334
}
335335

336-
# Does the $issue hashref have a task_comments field?
336+
# Does the $issue hashref have a task_d_planned field?
337337
# This field only appears on an issue once it has been updated.
338-
if (!exists $issue->{task_comments}) {
338+
if (!exists $issue->{task_d_planned}) {
339339
$self->logger->warn(sprintf(
340-
"[ATAK] No task comments field found on updated issue %s. Skipping.",
340+
"[ATAK] No task_d_planned field found on updated issue %s. Skipping.",
341341
$issue_reference
342342
));
343343
next;
@@ -346,11 +346,19 @@ sub _fetch_and_apply_updated_issues_info {
346346
# Does the task_comments field have a value?
347347
my $task_comments = $issue->{task_comments};
348348
if (!$task_comments) {
349-
$self->logger->warn(sprintf(
350-
"[ATAK] Task comments field on updated issue %s is blank. Defaulting to fixed status.",
351-
$issue_reference
352-
));
353-
$task_comments = $self->endpoint_config->{fixed_status};
349+
if ($time_planned && !$time_completed) {
350+
$self->logger->warn(sprintf(
351+
"[ATAK] Task comments field on updated issue %s is blank. Defaulting to planned status.",
352+
$issue_reference
353+
));
354+
$task_comments = $self->endpoint_config->{planned_status};
355+
} else {
356+
$self->logger->warn(sprintf(
357+
"[ATAK] Task comments field on updated issue %s is blank. Defaulting to fixed status.",
358+
$issue_reference
359+
));
360+
$task_comments = $self->endpoint_config->{fixed_status};
361+
}
354362
}
355363

356364
# Assumes no prefix is a substring of another prefix.

t/open311/endpoint/brent.t

+28-2
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ sub atak_config {
8686
"Closed - Out of scope" => "no_further_action",
8787
"Closed - Not found" => "closed",
8888
"Closed - Passed to Brent" => "internal_referral",
89+
"In progress" => "action_scheduled",
8990
},
9091
fixed_status => "Closed - Completed",
9192
closed_status => "Closed - Not found",
93+
planned_status => "In progress"
9294
}
9395
}
9496

@@ -881,6 +883,12 @@ subtest "GET ATAK service request updates OK" => sub {
881883
"task_d_completed": "2023-08-01T02:00:00Z",
882884
"task_d_approved": "2023-08-01T03:00:00Z",
883885
"task_p_id": "128"
886+
},
887+
{
888+
"client_ref":"in_progress",
889+
"task_d_created":"2023-08-01T00:00:00Z",
890+
"task_d_planned":"2023-08-01T01:00:00Z",
891+
"task_p_id": "129"
884892
}
885893
]
886894
}');
@@ -910,6 +918,15 @@ subtest "GET ATAK service request updates OK" => sub {
910918
updated_datetime => '2023-08-01T03:00:00Z',
911919
external_status_code => 'Closed - Completed',
912920
},
921+
{
922+
description => '',
923+
media_url => '',
924+
service_request_id => 'ATAK-129',
925+
status => 'action_scheduled',
926+
update_id => 'ATAK-in_progress_1690851600',
927+
updated_datetime => '2023-08-01T01:00:00Z',
928+
external_status_code => 'In progress',
929+
},
913930
{
914931
description => '',
915932
media_url => '',
@@ -982,6 +999,15 @@ subtest "GET ATAK service request updates OK" => sub {
982999
updated_datetime => '2023-08-01T03:00:00Z',
9831000
external_status_code => 'Closed - Completed',
9841001
},
1002+
{
1003+
description => '',
1004+
media_url => '',
1005+
service_request_id => 'ATAK-129',
1006+
status => 'action_scheduled',
1007+
update_id => 'ATAK-in_progress_1690851600',
1008+
updated_datetime => '2023-08-01T01:00:00Z',
1009+
external_status_code => 'In progress',
1010+
},
9851011
{
9861012
description => '',
9871013
media_url => '',
@@ -1011,7 +1037,7 @@ subtest "GET ATAK service request updates OK" => sub {
10111037
"task_d_planned": "2023-08-03T01:00:00Z",
10121038
"task_d_completed": "2023-08-03T02:00:00Z",
10131039
"task_d_approved": "2023-08-03T03:00:00Z",
1014-
"task_p_id": "129"
1040+
"task_p_id": "130"
10151041
}
10161042
]
10171043
}');
@@ -1026,7 +1052,7 @@ subtest "GET ATAK service request updates OK" => sub {
10261052
{
10271053
description => "description",
10281054
media_url => '',
1029-
service_request_id => 'ATAK-129',
1055+
service_request_id => 'ATAK-130',
10301056
status => 'fixed',
10311057
update_id => 'ATAK-test_1691031600',
10321058
updated_datetime => '2023-08-03T03:00:00Z',

0 commit comments

Comments
 (0)