Skip to content

Commit

Permalink
[Bexley] Missed bins can be reported after collection complete
Browse files Browse the repository at this point in the history
Missed bins can be reported on the day of collection once the round has
been completed.
  • Loading branch information
chrismytton committed May 2, 2024
1 parent 6ca9636 commit 45caae4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions perllib/FixMyStreet/Cobrand/Bexley/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,10 @@ sub can_report_missed {
my $min_dt = $self->_subtract_working_days(WORKING_DAYS_WINDOW);
my $today_dt
= DateTime->today( time_zone => FixMyStreet->local_time_zone );
my $now_dt
= DateTime->now( time_zone => FixMyStreet->local_time_zone );

return ( $log_for_round->{date} < $today_dt
return ( $log_for_round->{date} < $now_dt
&& $log_for_round->{date} >= $min_dt ) ? 1 : 0
if $log_for_round;

Expand All @@ -455,8 +457,6 @@ sub can_report_missed {
# OR
# b) collection was been made over WORKING_DAYS_WINDOW ago
# OR
# c) collection is today
# OR
# c) new service, so no last collection expected
return 0;
}
Expand Down
8 changes: 8 additions & 0 deletions perllib/Integrations/Whitespace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,12 @@ sub GetSiteContracts {
return $res->{SiteContracts}->{SiteContract};
}

sub GetServiceItems {
my ($self, $site_service_id) = @_;

Check warning on line 204 in perllib/Integrations/Whitespace.pm

View check run for this annotation

Codecov / codecov/patch

perllib/Integrations/Whitespace.pm#L204

Added line #L204 was not covered by tests

my $res = $self->call('GetServiceItems', serviceItemInput => ixhash( ServiceId => $site_service_id, ServiceItemId => '' ));

Check warning on line 206 in perllib/Integrations/Whitespace.pm

View check run for this annotation

Codecov / codecov/patch

perllib/Integrations/Whitespace.pm#L206

Added line #L206 was not covered by tests

return $res->{ServiceItems}->{ServiceItem};

Check warning on line 208 in perllib/Integrations/Whitespace.pm

View check run for this annotation

Codecov / codecov/patch

perllib/Integrations/Whitespace.pm#L208

Added line #L208 was not covered by tests
}

1;
4 changes: 2 additions & 2 deletions t/app/controller/waste_bexley.t
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,8 @@ FixMyStreet::override_config {
'cannot report missed collection against service due today that has not been collected';
ok !$services{'FO-23'}{last}{is_delayed}, 'not marked delayed';

is $cobrand->can_report_missed( $property, $services{'FO-140'} ), 0,
'cannot report missed collection against service due today that *has* been collected';
is $cobrand->can_report_missed( $property, $services{'FO-140'} ), 1,
'can report missed collection against service due today that *has* been collected';
ok !$services{'FO-140'}{last}{is_delayed}, 'not marked delayed';

is $cobrand->can_report_missed( $property, $services{'RES-180'} ), 0,
Expand Down

0 comments on commit 45caae4

Please sign in to comment.