Bug 32891 - Curbside pickups - Cannot select slot in the last hour
Summary: Curbside pickups - Cannot select slot in the last hour
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords: rel_22_11_candidate
Depends on: 30650
Blocks:
  Show dependency treegraph
 
Reported: 2023-02-06 18:13 UTC by Caroline Cyr La Rose
Modified: 2023-12-28 20:42 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.04
Circulation function:


Attachments
Bug 32891: Fix slot selection in last hour (3.84 KB, patch)
2023-02-07 07:52 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32891: Fix slot selection in last hour (3.89 KB, patch)
2023-02-07 10:06 UTC, David Nind
Details | Diff | Splinter Review
Bug 32891: Fix slot selection in last hour (3.96 KB, patch)
2023-02-07 14:28 UTC, Caroline Cyr La Rose
Details | Diff | Splinter Review
Bug 32891: Fix slot selection in last hour (4.01 KB, patch)
2023-02-21 13:09 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 32891: (QA follow-up) Fix perlcritic error (1.06 KB, patch)
2023-02-21 13:09 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2023-02-06 18:13:09 UTC
Sometimes, I get an error message "Wrong slot selected". I'm hoping someone will understand why this happens. I think it's a bug since the selected slot exists, is displayed and the maximum number of patrons hasn't been reached.

Here is my curbside pickup config https://snipboard.io/o6sqi1.jpg

I selected 19:40 for today, Monday, Feb 6 https://snipboard.io/r1HdBz.jpg (I did this a bit before 11:30 (screenshot was taken at 11:23:49), if that changes something) The slot has no patrons, and when clicked it becomes green

Wrong slot selected https://snipboard.io/w7WzTm.jpg

This completely stops the scheduling process. I have to search for the patron again and select another slot to try again. There's no way to know which slot is "wrong" so it's trial and error until I get one that is ok.
Comment 1 David Nind 2023-02-06 18:40:11 UTC
I tested Caroline's setup and I get the same message as well:

1. I don't think it is the order of the time slots, as it happened to me for a day when they were in order (Monday) (see bug 32788).

2. I changed Henry's home library to Centerville, but the message still occurred.

3. I couldn't see any errors in the browser console or error logs.

4. I also tried days a week or two in the future, but it still occurred.

5. There are tests (in t/db_dependent/Koha/CurbsidePickups.t) that generate the "Wrong slot selected" message - they seem logical, but shouldn't be something that you can replicate in the staff interface as you can only select from the date and times configured and displayed:
   #Day is not ok 
   Cannot create a pickup on a day without opening slots defined
   #Day ok but datetime not ok
   Cannot create a pickup on a time without opening slots defined
   #Day ok, datetime inside the opening slot, but wrong (15:15 for instance)
   Cannot create a pickup on a time that is not matching the start of an interval

IRC log discussion links:
* 2023-02-03: https://irc.koha-community.org/koha/2023-02-03#i_2470945
* 2023-02-06: https://irc.koha-community.org/koha/2023-02-06#i_2471054
Comment 2 Jonathan Druart 2023-02-07 07:52:53 UTC
Created attachment 146306 [details] [review]
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
Comment 3 David Nind 2023-02-07 10:06:43 UTC
Created attachment 146314 [details] [review]
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

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2023-02-07 10:07:37 UTC
Thanks Jonathan for figuring out the cause of the issue!
Comment 5 Caroline Cyr La Rose 2023-02-07 14:28:04 UTC
Created attachment 146332 [details] [review]
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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 6 Caroline Cyr La Rose 2023-02-07 14:28:25 UTC
Thanks Jonathan!
Comment 7 Tomás Cohen Arazi (tcohen) 2023-02-21 13:09:03 UTC
Created attachment 147026 [details] [review]
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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 8 Tomás Cohen Arazi (tcohen) 2023-02-21 13:09:06 UTC
Created attachment 147027 [details] [review]
Bug 32891: (QA follow-up) Fix perlcritic error

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 9 Tomás Cohen Arazi (tcohen) 2023-02-22 12:08:24 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 10 Jacob O'Mara 2023-02-24 11:33:08 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 11 Jacob O'Mara 2023-02-24 11:36:20 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 12 Lucas Gass (lukeg) 2023-03-01 14:57:22 UTC
Missing dependencies for 22.05.x, no backport.