Skip to content

Commit

Permalink
[Bexley] Spot logs with more text in their round.
Browse files Browse the repository at this point in the history
Manual exceptions have round codes like
"(Mon) GDN-R1" rather than just GDN-R1.
  • Loading branch information
dracos committed Dec 11, 2024
1 parent 0f38084 commit 01c1c52
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/Cobrand/Bexley/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ sub bin_services_for_address {
$filtered_service->{report_locked_out_reason} = '';
my $log_reason_prefix = $self->get_in_cab_logs_reason_prefix($filtered_service->{service_id});
if ($log_reason_prefix) {
my @relevant_logs = grep { $_->{reason} =~ /^$log_reason_prefix/ && $_->{round} eq $filtered_service->{round} } @$property_logs;
my @relevant_logs = grep { $_->{reason} =~ /^$log_reason_prefix/ && $_->{round} =~ /\Q$filtered_service->{round}\E/ } @$property_logs;
if (@relevant_logs) {
$filtered_service->{report_locked_out} = 1;
$filtered_service->{report_locked_out_reason} = $relevant_logs[0]->{reason};
Expand Down
24 changes: 24 additions & 0 deletions t/app/controller/waste_bexley.t
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,30 @@ FixMyStreet::override_config {
$mech->content_lacks('Reported as collected today');
$mech->content_contains('Could not be collected today because it was red-tagged. See reason below.');

note 'Property has collection but also manual red tag';
$whitespace_mock->mock( 'GetInCabLogsByUsrn', sub {
return [
{
LogID => 1,
Reason => 'N/A',
RoundCode => 'RND-8-9',
LogDate => '2024-04-01T12:00:00.417',
Uprn => '',
Usrn => '321',
},
{
LogID => 2,
Reason => 'Paper & Card - Bin has gone feral',
RoundCode => '(Mon) RND-8-9',
LogDate => '2024-04-01T12:00:00.417',
Uprn => '10001',
Usrn => '321',
},
];
});
$mech->get_ok('/waste/10001');
$mech->content_contains('Could not be collected today because it was red-tagged. See reason below.');

note 'Red tag on other property on same street';
$whitespace_mock->mock( 'GetInCabLogsByUsrn', sub {
return [
Expand Down

0 comments on commit 01c1c52

Please sign in to comment.