Skip to content

Commit

Permalink
fixup! [Brent] Bulky waste missed can be reported if no event by 6pm
Browse files Browse the repository at this point in the history
  • Loading branch information
MorayMySoc committed Aug 2, 2024
1 parent 0f1cf14 commit 2a34ba5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 4 additions & 2 deletions perllib/FixMyStreet/Cobrand/Brent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1668,8 +1668,10 @@ sub bulky_open_overdue {

sub _bulky_collection_overdue {
my $collection_due_date = $_[1]->{date};
$collection_due_date->truncate(to => 'day')->set_hour(18);
my $today = DateTime->now->set_time_zone(FixMyStreet->local_time_zone);

$collection_due_date->add(days => 1)->truncate(to => 'day')->set_hour(0);
my $today = DateTime->now->set_time_zone($collection_due_date->time_zone);

return $today > $collection_due_date;
}

Expand Down
13 changes: 12 additions & 1 deletion t/app/controller/waste_brent_small_items.t
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ FixMyStreet::override_config {
my $report_id = $report->id;
$report->update({ external_id => 'a-guid' });

# Fixed date still set to 5th July
# Fixed date still set to 25th June
$mech->get_ok('/waste/12345');
$mech->content_lacks('Report a small items collection as missed');
$mech->get_ok('/waste/12345/report');
Expand All @@ -477,6 +477,17 @@ FixMyStreet::override_config {
$mech->content_lacks('Report a small items collection as missed', 'Too long ago');
$mech->get_ok('/waste/12345/report');
$mech->content_lacks('Small items collection');
$echo->mock( 'GetEventsForObject', sub { [ {
Guid => 'a-guid',
EventTypeId => 2964,
} ] } );
ok set_fixed_time('2023-07-01T22:59:59Z'), 'Set current date to 1st July';
$mech->get_ok('/waste/12345');
$mech->content_lacks('Report a small items collection as missed', 'Can not report on due date when no resolution');
ok set_fixed_time('2023-07-02T05:44:59Z'), 'Set current date to 2nd July';
$mech->get_ok('/waste/12345');
$mech->content_contains('Report a small items collection as missed', 'Can report when due date passed and no resolution');
ok set_fixed_time('2023-06-25T05:44:59Z'), 'Reset current date to 25th June for consistency';
$echo->mock( 'GetEventsForObject', sub { [ {
Guid => 'a-guid',
EventTypeId => 2964,
Expand Down

0 comments on commit 2a34ba5

Please sign in to comment.