From fb1cf865d09aa05da6de2c9fc6c550022d499260 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 16 Jun 2020 10:41:25 -0400 Subject: [PATCH] LP#1879983: adjust available appointment times This patch ensures that the first available appointment time falls no sooner than two granularity intervals from the current time. This is meant to give library staff enough time to stage items. The value of two step intervals is arbitrary and could be made configurable in the future, though it does follow the hard-coding of the horizon in fetch_to_be_staged(). Signed-off-by: Galen Charlton --- Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm index d3b76fdbde..263e77c4b4 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm @@ -539,6 +539,13 @@ sub times_for_date { my $end_obj = $date_parser->parse_datetime($date.'T'.$close_time)->set_time_zone($tz); my $now_obj = DateTime->now; # NOTE: does not need timezone set because it gets UTC, not floating, so we can math with it + # Add two step intervals to avoid having an appointment be scheduled + # sooner than the library could stage the items. Setting the earliest + # available time to be no earlier than two intervals from now + # is arbitrary and could be made configurable in the future, though + # it does follow the hard-coding of the horizon in fetch_to_be_staged(). + $now_obj->add(seconds => 2 * $gran_seconds); + my $step_obj = $start_obj->clone; while (DateTime->compare($step_obj,$end_obj) < 0) { # inside HOO if (DateTime->compare($step_obj,$now_obj) >= 0) { # only offer times in the future -- 2.11.0