diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 6 | ||||
-rw-r--r-- | t/cobrand/bromley.t | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index 4b1406316..e84ea6f30 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -542,7 +542,6 @@ sub bin_services_for_address { id => $_->{Id}, service_id => $_->{ServiceId}, service_name => $service_name_override{$_->{ServiceId}} || $_->{ServiceName}, - report_allowed => within_working_days($schedules->{last}{date}, 2), report_open => $open->{missed}->{$_->{ServiceId}}, request_allowed => $request_allowed{$_->{ServiceId}}, request_open => $open_request, @@ -564,6 +563,7 @@ sub bin_services_for_address { } if (%task_ref_to_row) { my $tasks = $echo->GetTasks(map { $_->{last}{ref} } values %task_ref_to_row); + my $now = DateTime->now->set_time_zone(FixMyStreet->local_time_zone); foreach (@$tasks) { my $ref = join(',', @{$_->{Ref}{Value}{anyType}}); my $completed = construct_bin_date($_->{CompletedDate}); @@ -574,6 +574,10 @@ sub bin_services_for_address { $row->{last}{state} = $state; $row->{last}{completed} = $completed; $row->{last}{resolution} = $resolution; + $row->{report_allowed} = within_working_days($row->{last}{date}, 2); + if (!$completed && $row->{last}{date}->ymd eq $now->ymd) { + $row->{report_allowed} = 0; + } } } diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t index 3578f10fb..a60f72b0d 100644 --- a/t/cobrand/bromley.t +++ b/t/cobrand/bromley.t @@ -290,6 +290,7 @@ subtest 'test reporting before/after completion' => sub { $mech->get_ok('/waste/uprn/12345'); $mech->content_contains('(completed at 10:00am)'); $mech->content_contains('Wrong Bin Out'); + $mech->content_lacks('Report a refuse collection'); $mech->content_contains('Report a paper & cardboard collection as missed'); set_fixed_time('2020-05-28T12:00:00Z'); $mech->get_ok('/waste/uprn/12345'); |