From e52a155c8dd50c8d62655eb7d7639252f9a4e196 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 7 Nov 2023 17:14:04 +0000 Subject: [PATCH] [Waste] Clear slots before reserving anew. --- perllib/FixMyStreet/Roles/CobrandEcho.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/perllib/FixMyStreet/Roles/CobrandEcho.pm b/perllib/FixMyStreet/Roles/CobrandEcho.pm index 78b00a2a655..6b82ee9b9f8 100644 --- a/perllib/FixMyStreet/Roles/CobrandEcho.pm +++ b/perllib/FixMyStreet/Roles/CobrandEcho.pm @@ -696,10 +696,13 @@ sub check_bulky_slot_available { # Note: Both $slot_expiry_dt and $now_dt are UTC if ( $slot_expiry_dt <= $now_dt ) { - # Call ReserveAvailableSlots again, try to get - # the same collection date + # Cancel the expired slots and call ReserveAvailableSlots again, try to + # get the same collection date + my $property = $self->{c}->stash->{property}; + $self->clear_cached_lookups_bulky_slots($property->{id}); + my $available_slots = $self->find_available_bulky_slots( - $self->{c}->stash->{property}, undef, 'no_cache' ); + $property, undef, 'no_cache' ); my ($slot) = grep { $_->{date} eq $collection_date } @$available_slots;