Skip to content

Commit

Permalink
[Bexley] Check red tags and service exceptions separately
Browse files Browse the repository at this point in the history
The concept of "round exceptions" doesn't really make sense. Instead
we're dealing with service exceptions (problems accessing the street,
for example) and red tags (which are on a specific container). So do
these as two separate checks, one on the propery, one on the service,
when determining if a missed collection can be reported.
  • Loading branch information
chrismytton committed May 23, 2024
1 parent 6d20a13 commit 5f33363
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
16 changes: 9 additions & 7 deletions perllib/FixMyStreet/Cobrand/Bexley/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ sub bin_services_for_address {

$property->{red_tags} = $property_logs;
$property->{service_updates} = grep { $_->{service_update} } @$street_logs;
my %round_exceptions = map { $_->{round} => 1 } @$property_logs;
$property->{round_exceptions} = \%round_exceptions;

# Set certain things outside of services loop
my $containers = $self->_containers($property);
Expand Down Expand Up @@ -226,9 +224,6 @@ sub bin_services_for_address {
$filtered_service->{report_open} = 0;
}

$filtered_service->{report_allowed}
= $self->can_report_missed( $property, $filtered_service );

$filtered_service->{report_locked_out} = 0;
$filtered_service->{report_locked_out_reason} = '';
my $log_reason_prefix = $self->get_in_cab_logs_reason_prefix($filtered_service->{service_id});
Expand All @@ -241,6 +236,9 @@ sub bin_services_for_address {

}

$filtered_service->{report_allowed}
= $self->can_report_missed( $property, $filtered_service );

push @site_services_filtered, $filtered_service;
}

Expand Down Expand Up @@ -429,8 +427,12 @@ sub can_report_missed {
# Cannot make a report if there is already an open one for this service
return 0 if $property->{missed_collection_reports}{ $service->{service_id} };

# Can't make a report if an exception has been logged for the service's round
return 0 if $property->{round_exceptions}{ $service->{round} };
# Prevent reporting if there are service updates
return 0 if $property->{service_updates};

# Prevent reporting if there are red tags on the service
# Red tags are matched to services based on prefix
return 0 if $service->{report_locked_out};

# Needs to be within 3 working days of the last completed round, today
# not included.
Expand Down
3 changes: 0 additions & 3 deletions t/app/controller/waste_bexley.t
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,6 @@ FixMyStreet::override_config {
missed_collection_reports => {
'RES-SACK' => 1,
},
round_exceptions => {
'MDR-R1' => 1, # MDR-SACK
},
recent_collections => {
'RCY-R1 Mon' => DateTime->today, # FO-23
'RCY-R2 Mon' => DateTime->today, # FO-140
Expand Down

0 comments on commit 5f33363

Please sign in to comment.