[Bug 9211] New: days_between wrong behaviour
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Bug ID: 9211 Summary: days_between wrong behaviour Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Holidays Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com As noted in comments #15, #16 and #17 of bug 8486, and its API, Koha::Calendar->days_between should always returns a positive number irrespective of the relative order of the parameters. This is still an open bug, which arised when rewriting the Calendar.t file. Already have a patch for it. Attaching in a minute. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Change sponsored?|--- |Sponsored Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 13886 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=13886&action=edit Bug 9211 - days_between wrong behaviour As noted in comments #15, #16 and #17 of bug 8486, and its API, Koha::Calendar->days_between should always returns a positive number irrespective of the relative order of the parameters. This is still an open bug, which arised when rewriting the Calendar.t file (Bug 9209). Regards To+ Sponsored-by: Universidad Nacional de Córdoba -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #13886|0 |1 is obsolete| | --- Comment #2 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 13945 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=13945&action=edit [SIGNED-OFF] Bug 9211 - days_between wrong behaviour As noted in comments #15, #16 and #17 of bug 8486, and its API, Koha::Calendar->days_between should always returns a positive number irrespective of the relative order of the parameters. This is still an open bug, which arised when rewriting the Calendar.t file (Bug 9209). Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> http://bugs.koha-community.org/show_bug.cgi?id=9221 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 --- Comment #3 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 13946 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=13946&action=edit Bug 9211 - days_between wrong behaviour - Followup - Add Test to Calendar.t -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |9209 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Kyle, I've written that test in the context of bug 9209. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |paul.poulain@biblibre.com --- Comment #5 from Paul Poulain <paul.poulain@biblibre.com> --- QA Comment: * checking usage of days_between = - in C4/Circulation, it's used in _debar_user_on_return. The relevant lines are: my $deltadays = $calendar->days_between( $dt_due, $dt_today ); if ( $deltadays->subtract($grace)->is_positive() ) { => seems logical that $deltadays is positive - in C4/Overdues.pm, it's used in _get_chargeable_units $charge_duration = $calendar->days_between( $dt1, $dt2 ); => seems OK as well * patch passes koha-qa.pl * prove t/Calendar.t is working well after a tiny followup i'll attach TO RM = I don't see anything wrong with this patch, but it's a sensible one, so it's worth looking deeply !!! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 --- Comment #6 from Paul Poulain <paul.poulain@biblibre.com> --- Created attachment 14400 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14400&action=edit Bug 9211 follow-up fixing 2 tiny mistakes in unit test * the new test was not announced (26 announced, 27 run) * $daycount already declared, resulting in "my" variable $daycount masks earlier declaration in same scope at t/Calendar.t line 93. with this patch prove t/Calendar.t is green ;-) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #13946|0 |1 is obsolete| | Attachment #14400|0 |1 is obsolete| | --- Comment #7 from Paul Poulain <paul.poulain@biblibre.com> --- Created attachment 14401 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14401&action=edit Bug 9211 follow-up fixing 2 tiny mistakes in unit test * the new test was not announced (26 announced, 27 run) * $daycount already declared, resulting in "my" variable $daycount masks earlier declaration in same scope at t/Calendar.t line 93. with this patch prove t/Calendar.t is green ;-) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14401|0 |1 is obsolete| | --- Comment #8 from Paul Poulain <paul.poulain@biblibre.com> --- Created attachment 14402 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14402&action=edit Bug 9211 - days_between wrong behaviour - Followup - Add Test to Calendar.t Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 --- Comment #9 from Paul Poulain <paul.poulain@biblibre.com> --- Created attachment 14403 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14403&action=edit Bug 9211 follow-up fixing 2 tiny mistakes in unit test * the new test was not announced (26 announced, 27 run) * $daycount already declared, resulting in "my" variable $daycount masks earlier declaration in same scope at t/Calendar.t line 93. with this patch prove t/Calendar.t is green ;-) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |paul.poulain@biblibre.com --- Comment #10 from Paul Poulain <paul.poulain@biblibre.com> --- (sorry for multiple attachment, made a mistake...) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to comment #10)
(sorry for multiple attachment, made a mistake...)
I recall there were tests for this in 9109 already (pushed). I added 3, on a per syspref setup basis, To capture the syspref independent nature. I might be erong too, on my phone right now -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 --- Comment #12 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- Could we get a test plan so I can test this in the interface and not just in the unit test? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14402|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14403|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14402|1 |0 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14402|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 --- Comment #13 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to comment #12)
Could we get a test plan so I can test this in the interface and not just in the unit test?
I haven't found through the code an usage example that leaded to having the dates swapped. I assume the days_between method is intended to work whether the dates are ordered or not just in case it is needed. In that case, this bug just makes the implementation match the documented API. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #14 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- This patch has been pushed to master. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9211 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |chris@bigballofwax.co.nz --- Comment #15 from Chris Cormack <chris@bigballofwax.co.nz> --- Pushed to 3.10.x and 3.8.x will be in 3.10.3 and 3.8.10 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org