Skip to content

Commit

Permalink
[Bromley] Allow closed general enquiry updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Dec 5, 2024
1 parent 8ec4184 commit acb92bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
5 changes: 4 additions & 1 deletion perllib/FixMyStreet/Cobrand/Bromley.pm
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,10 @@ sub open311_waste_update_extra {
my $state_id = $event->{EventStateId};
my $resolution_id = $event->{ResolutionCodeId} || '';
my $description = $event_type->{states}{$state_id}{name} || '';
if ($description ne 'New' && $description ne 'Completed' && !$resolution_id) {

my $closed_general_enquiry = $event->{EventTypeId} == 2148 && $description eq 'Closed';
my $not_new_completed = $description ne 'New' && $description ne 'Completed';
if ($not_new_completed && !$resolution_id && !$closed_general_enquiry) {
$override_status = "";
}

Expand Down
17 changes: 14 additions & 3 deletions t/cobrand/bromley_waste.t
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,10 @@ subtest 'updating of waste reports' => sub {
if ($method eq 'GetEvent') {
my ($key, $type, $value) = ${$args[3]->value}->value;
my $external_id = ${$value->value}->value->value;
my ($waste, $event_state_id, $resolution_code) = split /-/, $external_id;
my ($waste, $event_state_id, $resolution_code, $event_type_id) = split /-/, $external_id;
return SOAP::Result->new(result => {
EventStateId => $event_state_id,
EventTypeId => '2104',
EventTypeId => $event_type_id || '2104',
LastUpdatedDate => { OffsetMinutes => 60, DateTime => '2020-06-24T14:00:00Z' },
ResolutionCodeId => $resolution_code,
});
Expand All @@ -555,6 +555,7 @@ subtest 'updating of waste reports' => sub {
{ ResolutionCodeId => 206, Name => 'Out of Time' },
{ ResolutionCodeId => 207, Name => 'Duplicate' },
] } },
{ CoreState => 'Closed', Name => 'Closed', Id => 15007 },
] } },
});
} else {
Expand Down Expand Up @@ -591,6 +592,16 @@ subtest 'updating of waste reports' => sub {
is $report->comments->count, $comment_count, 'No new update';
is $report->state, 'confirmed', 'No state change';

# Test general enquiry closed
$report->update({ external_id => 'waste-15007--2148' });
stdout_like {
$cobrand->waste_fetch_events({ verbose => 1 });
} qr/Fetching data for report/;
$report->discard_changes;
is $report->comments->count, ++$comment_count, 'No new update';
is $report->state, 'fixed - council', 'State change to fixed';
$report->update({ state => 'confirmed' }); # Reset back

$report->update({ external_id => 'waste-15003-' });
stdout_like {
$cobrand->waste_fetch_events({ verbose => 1 });
Expand All @@ -605,7 +616,7 @@ subtest 'updating of waste reports' => sub {
} qr/Updating report to state action scheduled, Allocated to Crew/;
$report->discard_changes;
is $report->comments->count, ++$comment_count, 'A new update';
my $update = $report->comments->first;
my $update = FixMyStreet::DB->resultset('Comment')->order_by('-id')->first;
is $update->text, 'This has been allocated';
is $report->state, 'action scheduled', 'A state change';

Expand Down

0 comments on commit acb92bb

Please sign in to comment.