Skip to content

Commit

Permalink
[Bexley] Show delayed message after 5pm
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismytton committed May 14, 2024
1 parent 3e5f222 commit ff883b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 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 @@ -452,9 +452,9 @@ sub can_report_missed {
&& $log_for_round->{date} >= $min_dt ) ? 1 : 0
if $log_for_round;

$service->{last}{is_delayed} = 1
if $last_expected_collection_dt < $today_dt
&& $last_expected_collection_dt >= $min_dt;
$service->{last}{is_delayed} =
($last_expected_collection_dt < $today_dt && $last_expected_collection_dt >= $min_dt)
|| ($service->{next}{is_today} && $now_dt->hour >= 17) ? 1 : 0;
}

# At this point, missed report is not allowed because
Expand Down
9 changes: 9 additions & 0 deletions t/app/controller/waste_bexley.t
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ FixMyStreet::override_config {
service_id => 'FO-23',
round => 'RCY-R1',
round_schedule => 'RCY-R1 Mon',
next => {
is_today => 1,
},
},
# Had a collection earlier today
'FO-140' => {
Expand Down Expand Up @@ -627,6 +630,12 @@ FixMyStreet::override_config {
'cannot report missed collection against service whose round was collected more than 3 working days ago';
ok !$services{'PG-240'}{last}{is_delayed}, 'not marked delayed';

# After 5pm, so FO-23 is now considered delayed
set_fixed_time('2024-04-22T16:00:00'); # Monday, 17:00 BST
is $cobrand->can_report_missed( $property, $services{'FO-23'} ), 0,
'cannot report missed collection after 5pm against service due today that has not been collected';
ok $services{'FO-23'}{last}{is_delayed}, 'marked delayed';

# Put time back to previous value
set_fixed_time('2024-03-31T01:00:00'); # March 31st, 02:00 BST
};
Expand Down

0 comments on commit ff883b7

Please sign in to comment.