[Bug 18697] New: Fix date calculations for day/week frequencies in Serials
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Bug ID: 18697 Summary: Fix date calculations for day/week frequencies in Serials Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Serials Assignee: koha-bugs@lists.koha-community.org Reporter: m.de.rooy@rijksmuseum.nl QA Contact: testopia@bugs.koha-community.org CC: colin.campbell@ptfs-europe.com See also bug 18356 and 18607. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |m.de.rooy@rijksmuseum.nl |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |18607 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18607 [Bug 18607] Fix date calculations for monthly frequencies in Serials -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #1 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 63846 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=63846&action=edit Bug 18697: Fix date calculations for weekly frequencies in Serials Same solution applied as in bug 18356/18607. Consistency++ The code in _get_next_date_week is again very similar to the code in _get_next_date_month or _get_next_date_year. I will not merge them here, but we could consider that in the future. Code in GetFictiveIssueNo has been adjusted similarly to month and year. It might be interesting to merge it with the code for unit 'day'. Test plan: [1] Do not apply this patch. Create a subscription for 3/week. When the first issue date is on a Saturday or Sunday, the intervals in the prediction pattern are 0,0,7,0,0,7,etc. Starting on Wed-Fri 1,1,5,etc. Starting on Mon-Tue 2,2,3,etc. [2] Apply this patch. Check again. The interval should be always 2,2,3 now and no longer depend on the day_of_week of first issue date. [3] Check another weekly frequency with multiple units per issue. Say 1 issue/3 weeks. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #2 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 63847 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=63847&action=edit Bug 18697: Adjusting unit tests for weekly serial frequencies Corrections and added unit tests following the changes of the first patch. GetFictiveIssueNumber.t: New subtest for weekly frequencies. GetNextDate.t: Correcting a few dates one day. If we use 2/week, we will calculate an interval of 3 days and correct with 4 days at the end of the cycle. The connection with firstacqui is not relevant anymore. Test plan: [1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t [2] Run t/db_dependent/Serials/GetNextDate.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #63846|0 |1 is obsolete| | --- Comment #3 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 63867 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=63867&action=edit Bug 18697: Fix date calculations for weekly frequencies in Serials Same solution applied as in bug 18356/18607. Consistency++ The code in _get_next_date_week is again very similar to the code in _get_next_date_month or _get_next_date_year. I will not merge them here, but we could consider that in the future. Code in GetFictiveIssueNo has been adjusted similarly to month and year. Test plan: [1] Do not apply this patch. Create a subscription for 3/week. When the first issue date is on a Saturday or Sunday, the intervals in the prediction pattern are 0,0,7,0,0,7,etc. Starting on Wed-Fri 1,1,5,etc. Starting on Mon-Tue 2,2,3,etc. [2] Apply this patch. Check again. The interval should be always 2,2,3 now and no longer depend on the day_of_week of first issue date. [3] Check another weekly frequency with multiple units per issue. Say 1 issue/3 weeks. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #63847|0 |1 is obsolete| | --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 63868 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=63868&action=edit Bug 18697: Adjusting unit tests for weekly serial frequencies Corrections and added unit tests following the changes of the first patch. GetFictiveIssueNumber.t: New subtest for weekly frequencies. GetNextDate.t: Correcting a few dates one day. If we use 2/week, we will calculate an interval of 3 days and correct with 4 days at the end of the cycle. The connection with firstacqui is not relevant anymore. Test plan: [1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t [2] Run t/db_dependent/Serials/GetNextDate.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #5 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 63869 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=63869&action=edit Bug 18697: Fix date calculation for dayly frequencies in Serials The changes in _get_next_date_day are actually only cosmetic. The sub now reads exactly the same as its counterparts for other units, but the results are exactly the same as before. In GetFictiveIssueNumber we now call _delta_units for each type of unit. The two Delta_Days calls are moved to _delta_units. Note that this also is a cosmetic change; results should be exactly the same. Test plan: [1] Edit a subscription. Test predication pattern for some daily freq. [2] Run t/db_dependent/GetNextDate.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 63870 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=63870&action=edit Bug 18697: Adjusting unit tests for dayly serial frequencies No changes were needed for GetNextDate.t. In GetFictiveIssueNumber.t we add a subtest for daily frequencies. Test plan: [1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #7 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 63871 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=63871&action=edit Bug 18697: Final polishing GetFictiveIssueNumber: Returns undef instead of 0 for irregular frequencies. Also added to POD. Removed unused variable $wkno. Adding a return makes the if(unit) unneeded. Replaced (a+b)/b by 1+a/b. _delta_units: Added a comment about its parameters. GetFictiveIssueNumber.t: Adjusted the tests for irregular frequencies accordingly. Test plan: [1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t [2] Run t/db_dependent/Serials/GetNextDate.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=18356 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #8 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Note for testers: As you can read in the commit messages, the fix mainly concerns weekly frequencies. The daily frequencies work fine; the code is only changed to make it more consistent with week/month/year. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #63867|0 |1 is obsolete| | Attachment #63868|0 |1 is obsolete| | Attachment #63869|0 |1 is obsolete| | Attachment #63870|0 |1 is obsolete| | Attachment #63871|0 |1 is obsolete| | --- Comment #9 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 64025 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64025&action=edit [SIGNED-OFF] Bug 18697: Fix date calculations for weekly frequencies in Serials Same solution applied as in bug 18356/18607. Consistency++ The code in _get_next_date_week is again very similar to the code in _get_next_date_month or _get_next_date_year. I will not merge them here, but we could consider that in the future. Code in GetFictiveIssueNo has been adjusted similarly to month and year. Test plan: [1] Do not apply this patch. Create a subscription for 3/week. When the first issue date is on a Saturday or Sunday, the intervals in the prediction pattern are 0,0,7,0,0,7,etc. Starting on Wed-Fri 1,1,5,etc. Starting on Mon-Tue 2,2,3,etc. [2] Apply this patch. Check again. The interval should be always 2,2,3 now and no longer depend on the day_of_week of first issue date. [3] Check another weekly frequency with multiple units per issue. Say 1 issue/3 weeks. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #10 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 64026 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64026&action=edit [SIGNED-OFF] Bug 18697: Adjusting unit tests for weekly serial frequencies Corrections and added unit tests following the changes of the first patch. GetFictiveIssueNumber.t: New subtest for weekly frequencies. GetNextDate.t: Correcting a few dates one day. If we use 2/week, we will calculate an interval of 3 days and correct with 4 days at the end of the cycle. The connection with firstacqui is not relevant anymore. Test plan: [1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t [2] Run t/db_dependent/Serials/GetNextDate.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #11 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 64027 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64027&action=edit [SIGNED-OFF] Bug 18697: Fix date calculation for dayly frequencies in Serials The changes in _get_next_date_day are actually only cosmetic. The sub now reads exactly the same as its counterparts for other units, but the results are exactly the same as before. In GetFictiveIssueNumber we now call _delta_units for each type of unit. The two Delta_Days calls are moved to _delta_units. Note that this also is a cosmetic change; results should be exactly the same. Test plan: [1] Edit a subscription. Test predication pattern for some daily freq. [2] Run t/db_dependent/GetNextDate.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #12 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 64028 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64028&action=edit [SIGNED-OFF] Bug 18697: Adjusting unit tests for dayly serial frequencies No changes were needed for GetNextDate.t. In GetFictiveIssueNumber.t we add a subtest for daily frequencies. Test plan: [1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #13 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 64029 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64029&action=edit [SIGNED-OFF] Bug 18697: Final polishing GetFictiveIssueNumber: Returns undef instead of 0 for irregular frequencies. Also added to POD. Removed unused variable $wkno. Adding a return makes the if(unit) unneeded. Replaced (a+b)/b by 1+a/b. _delta_units: Added a comment about its parameters. GetFictiveIssueNumber.t: Adjusted the tests for irregular frequencies accordingly. Test plan: [1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t [2] Run t/db_dependent/Serials/GetNextDate.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Thanks Josef ! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #64025|0 |1 is obsolete| | Attachment #64026|0 |1 is obsolete| | Attachment #64027|0 |1 is obsolete| | Attachment #64028|0 |1 is obsolete| | Attachment #64029|0 |1 is obsolete| | CC| |kyle@bywatersolutions.com Status|Signed Off |Passed QA Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #15 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 64317 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64317&action=edit Bug 18697: Fix date calculations for weekly frequencies in Serials Same solution applied as in bug 18356/18607. Consistency++ The code in _get_next_date_week is again very similar to the code in _get_next_date_month or _get_next_date_year. I will not merge them here, but we could consider that in the future. Code in GetFictiveIssueNo has been adjusted similarly to month and year. Test plan: [1] Do not apply this patch. Create a subscription for 3/week. When the first issue date is on a Saturday or Sunday, the intervals in the prediction pattern are 0,0,7,0,0,7,etc. Starting on Wed-Fri 1,1,5,etc. Starting on Mon-Tue 2,2,3,etc. [2] Apply this patch. Check again. The interval should be always 2,2,3 now and no longer depend on the day_of_week of first issue date. [3] Check another weekly frequency with multiple units per issue. Say 1 issue/3 weeks. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> --- Comment #16 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 64318 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64318&action=edit Bug 18697: Adjusting unit tests for weekly serial frequencies Corrections and added unit tests following the changes of the first patch. GetFictiveIssueNumber.t: New subtest for weekly frequencies. GetNextDate.t: Correcting a few dates one day. If we use 2/week, we will calculate an interval of 3 days and correct with 4 days at the end of the cycle. The connection with firstacqui is not relevant anymore. Test plan: [1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t [2] Run t/db_dependent/Serials/GetNextDate.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> --- Comment #17 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 64319 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64319&action=edit Bug 18697: Fix date calculation for dayly frequencies in Serials The changes in _get_next_date_day are actually only cosmetic. The sub now reads exactly the same as its counterparts for other units, but the results are exactly the same as before. In GetFictiveIssueNumber we now call _delta_units for each type of unit. The two Delta_Days calls are moved to _delta_units. Note that this also is a cosmetic change; results should be exactly the same. Test plan: [1] Edit a subscription. Test predication pattern for some daily freq. [2] Run t/db_dependent/GetNextDate.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> --- Comment #18 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 64320 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64320&action=edit Bug 18697: Adjusting unit tests for dayly serial frequencies No changes were needed for GetNextDate.t. In GetFictiveIssueNumber.t we add a subtest for daily frequencies. Test plan: [1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> --- Comment #19 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 64321 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64321&action=edit Bug 18697: Final polishing GetFictiveIssueNumber: Returns undef instead of 0 for irregular frequencies. Also added to POD. Removed unused variable $wkno. Adding a return makes the if(unit) unneeded. Replaced (a+b)/b by 1+a/b. _delta_units: Added a comment about its parameters. GetFictiveIssueNumber.t: Adjusted the tests for irregular frequencies accordingly. Test plan: [1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t [2] Run t/db_dependent/Serials/GetNextDate.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> --- Comment #20 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 17.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal --- Comment #21 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Changing severity. If the 18356/607 are backported, it would be logical to pick this one too. Daily frequencies are not affected (in behavior); this report fixes bugs for weekly frequencies. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Status|Pushed to Master |Pushed to Stable --- Comment #22 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Pushed to 17.05.x, will be in 17.05.02 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #23 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- These patches have been pushed to 16.11.x and will be in 16.11.10. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18697 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtj@kohaaloha.com --- Comment #24 from Mason James <mtj@kohaaloha.com> --- Pushed to 16.05.x, for 16.05.15 release -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org