aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-07-13 17:43:56 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-11-11 10:29:20 +0000
commit627daaad7d21817a301bcf604e15d230a4dca1c1 (patch)
tree0d80e101e41ae1f4459b266122cd15e74d5ab795
parent49dff7e4e4b7b6572cbf75ccb94383fe516f0e7c (diff)
[Bromley] No report allowed on day, not completed.
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm6
-rw-r--r--t/cobrand/bromley.t1
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 &amp; cardboard collection as missed');
set_fixed_time('2020-05-28T12:00:00Z');
$mech->get_ok('/waste/uprn/12345');