Skip to content

Commit

Permalink
Merge branch 'sutton-not-completed-updates' into kingston-waste
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed May 10, 2024
2 parents 0e27af4 + 9f5b69b commit ae4c888
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
17 changes: 15 additions & 2 deletions perllib/FixMyStreet/Roles/Cobrand/SLWP.pm
Expand Up @@ -371,7 +371,7 @@ sub open311_post_send {
});
}

=item * Look for completion photos on updates
=item * Look for completion photos on updates, and ignore "Not Completed" without a resolution code
=cut

Expand All @@ -391,7 +391,20 @@ sub open311_waste_update_extra {
push @media, "data:image/$type,$value";
}
}
return @media ? ( media_url => \@media ) : ();

my $override_status;
my $event_type = $cfg->{event_types}{$event->{EventTypeId}};
my $state_id = $event->{EventStateId};
my $resolution_id = $event->{ResolutionCodeId} || '';
my $description = $event_type->{states}{$state_id}{name} || '';
if ($description eq 'Not Completed' && !$resolution_id) {
$override_status = "";
}

return (
@media ? ( media_url => \@media ) : (),
defined $override_status ? (status => $override_status ) : (),
);
}

=item * No updates on waste reports
Expand Down
9 changes: 9 additions & 0 deletions t/cobrand/sutton.t
Expand Up @@ -201,6 +201,7 @@ subtest 'updating of waste reports' => sub {
{ CoreState => 'Pending', Name => 'Allocated to Crew', Id => 15003 },
{ CoreState => 'Closed', Name => 'Completed', Id => 15004 },
{ CoreState => 'Closed', Name => 'Partially Completed', Id => 15005 },
{ CoreState => 'Closed', Name => 'Not Completed', Id => 15006 },
] } },
});
} else {
Expand Down Expand Up @@ -256,6 +257,14 @@ subtest 'updating of waste reports' => sub {
is $report->comments->count, 1, 'No new update';
is $report->state, 'investigating', 'State unchanged';

$report->update({ external_id => 'waste-15006-' });
stdout_like {
$cobrand->waste_fetch_events({ verbose => 1 });
} qr/Fetching data for report/;
$report->discard_changes;
is $report->comments->count, 1, 'No new update';
is $report->state, 'investigating', 'No state change';

$report->update({ external_id => 'waste-15004-' });
stdout_like {
$cobrand->waste_fetch_events({ verbose => 1 });
Expand Down

0 comments on commit ae4c888

Please sign in to comment.