Bugzilla – Attachment 107456 Details for
Bug 23382
Issuing rules failing after bug 20912
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23382: (RM follow-up) Revert "hours_between should match..."
Bug-23382-RM-follow-up-Revert-hoursbetween-should-.patch (text/plain), 1.62 KB, created by
Jonathan Druart
on 2020-07-28 08:04:11 UTC
(
hide
)
Description:
Bug 23382: (RM follow-up) Revert "hours_between should match..."
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-07-28 08:04:11 UTC
Size:
1.62 KB
patch
obsolete
>From de1697c87779d1624baa8eae19eb24c71a43ac74 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 5 Nov 2019 14:18:28 +0000 >Subject: [PATCH] Bug 23382: (RM follow-up) Revert "hours_between should > match..." > >This reverts commit a693c7243c23f888e2fad38a4fff9f37ff4a9301 which >caused regressions. > >The original loop compared start date to end date and iterated all the >way to start date equals end date. The alternate implimentation >inadvertantly looped from start date, skipped the first day then >iterated up to one day beyond end date. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Calendar.pm | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > >diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm >index 07faad58dd..fc63572b28 100644 >--- a/Koha/Calendar.pm >+++ b/Koha/Calendar.pm >@@ -344,17 +344,21 @@ sub hours_between { > # However for hourly loans the logic should be expanded to > # take into account open/close times then it would be a duration > # of library open hours >- # start and end should not be closed days > my $skipped_days = 0; >- while( $start_dt->compare($end_dt) < 1 ) { >- $start_dt->add( days => 1 ); >- $skipped_days++ if $self->is_holiday($start_dt); >+ for (my $dt = $start_dt->clone(); >+ $dt <= $end_dt; >+ $dt->add(days => 1) >+ ) { >+ if ($self->is_holiday($dt)) { >+ ++$skipped_days; >+ } > } > if ($skipped_days) { > $duration->subtract_duration(DateTime::Duration->new( hours => 24 * $skipped_days)); > } > > return $duration; >+ > } > > sub set_daysmode { >-- >2.20.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 23382
:
92221
|
92222
|
92236
|
92237
|
92238
|
92273
|
92274
|
92275
|
92276
|
93407
|
93408
|
93409
|
93410
|
93411
|
93412
|
94281
|
94282
|
94283
|
94284
|
94285
|
94286
|
94287
|
94288
|
94289
|
94723
|
94724
|
94725
|
94726
|
94727
|
94728
|
94729
|
94730
|
94731
|
94743
|
94755
|
94756
|
94757
|
94758
|
94759
|
94760
|
94761
|
94762
|
94763
|
94764
|
94765
|
94766
|
94774
|
94775
|
94776
|
94777
|
94778
|
94779
|
94780
|
94781
|
94782
|
94783
|
94784
| 107456 |
107457