Bugzilla – Attachment 146306 Details for
Bug 32891
Curbside pickups - Cannot select slot in the last hour
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32891: Fix slot selection in last hour
Bug-32891-Fix-slot-selection-in-last-hour.patch (text/plain), 3.84 KB, created by
Jonathan Druart
on 2023-02-07 07:52:53 UTC
(
hide
)
Description:
Bug 32891: Fix slot selection in last hour
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-02-07 07:52:53 UTC
Size:
3.84 KB
patch
obsolete
>From 46709e968f1e08de808b71f8c2b0fb5ddf5a3604 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 7 Feb 2023 08:48:29 +0100 >Subject: [PATCH] Bug 32891: Fix slot selection in last hour > >If the curbside pickup module is configured with slot not on the hour >(minutes=00), the slots in the last (not complete) hour won't be >selectable. > >Test plan: >Create the following configuration: >pickup interval: 10 >Opening hours: 08:00 to 11:30 >Create a pickup and select 11:10 or 11:20 >=> Without this patch the pickup is not created and the UI displays "Wrong slot selected" >=> With this patch you are able to create the pickup >--- > Koha/CurbsidePickupPolicy.pm | 2 +- > t/db_dependent/Koha/CurbsidePickups.t | 19 +++++++++++++------ > 2 files changed, 14 insertions(+), 7 deletions(-) > >diff --git a/Koha/CurbsidePickupPolicy.pm b/Koha/CurbsidePickupPolicy.pm >index 07e0719d170..8408b5f0c2a 100644 >--- a/Koha/CurbsidePickupPolicy.pm >+++ b/Koha/CurbsidePickupPolicy.pm >@@ -103,7 +103,7 @@ sub is_valid_pickup_datetime { > my $start = $datetime->clone->set_hour( $opening_slot->start_hour ) > ->set_minute( $opening_slot->start_minute ); > my $end = $datetime->clone->set_hour( $opening_slot->end_hour ) >- ->set_minute( $opening_slot->start_minute ); >+ ->set_minute( $opening_slot->end_minute ); > my $keep_going = 1; > my $slot_start = $start->clone; > my $slot_end = $slot_start->clone->add(minutes => $self->pickup_interval); >diff --git a/t/db_dependent/Koha/CurbsidePickups.t b/t/db_dependent/Koha/CurbsidePickups.t >index ead077ffe0b..908d563e82e 100755 >--- a/t/db_dependent/Koha/CurbsidePickups.t >+++ b/t/db_dependent/Koha/CurbsidePickups.t >@@ -56,7 +56,7 @@ my $policy = Koha::CurbsidePickupPolicy->new( > branchcode => $library->branchcode, > enabled => 1, > enable_waiting_holds_only => 0, >- pickup_interval => 30, >+ pickup_interval => 15, > patrons_per_interval => 2, > patron_scheduled_pickup => 1 > } >@@ -73,12 +73,12 @@ my $policy_disabled = Koha::CurbsidePickupPolicy->new( > )->store; > > # Open Mondays from 12 to 18 >-$policy->add_opening_slot('1-12:00-18:00'); >+$policy->add_opening_slot('1-12:00-18:45'); > > my $today = dt_from_string; > > subtest 'Create a pickup' => sub { >- plan tests => 9; >+ plan tests => 10; > > # Day and datetime are ok > my $next_monday = >@@ -99,7 +99,9 @@ subtest 'Create a pickup' => sub { > 'Koha::Exceptions::CurbsidePickup::NotEnabled', > 'Cannot create pickup if the policy does not allow it'; > >- $policy->enable_waiting_holds_only(1)->store; >+ $policy->enabled(1)->store; >+ >+ $policy->enable_waiting_holds_only(1)->store; > throws_ok { > Koha::CurbsidePickup->new($params)->store; > } >@@ -119,6 +121,11 @@ subtest 'Create a pickup' => sub { > > $cp->delete; > >+ $schedule_dt = $next_monday->set_hour(18)->set_minute(15)->set_second(00); >+ $cp = Koha::CurbsidePickup->new( { %$params, scheduled_pickup_datetime => $schedule_dt } )->store; >+ ok($cp); >+ $cp->delete; >+ > # Day is not ok > my $next_tuesday = > $today->clone->add( days => ( 2 - $today->day_of_week ) % 7 ); >@@ -137,8 +144,8 @@ subtest 'Create a pickup' => sub { > 'Koha::Exceptions::CurbsidePickup::NoMatchingSlots', > 'Cannot create a pickup on a time without opening slots defined'; > >- # Day ok, datetime inside the opening slot, but wrong (15:15 for instance) >- $schedule_dt = $next_monday->set_hour(15)->set_minute(15)->set_second(00); >+ # Day ok, datetime inside the opening slot, but wrong (15:07 for instance) >+ $schedule_dt = $next_monday->set_hour(15)->set_minute(07)->set_second(00); > throws_ok { > Koha::CurbsidePickup->new({%$params, scheduled_pickup_datetime => $schedule_dt})->store; > } >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32891
:
146306
|
146314
|
146332
|
147026
|
147027