To reproduce: Set a frequency with: Unit: Year Issues per unit: 9 Units per issue: 1 OR Unit: Year Issues per unit: 12 Units per issue: 1 Notice the prediction pattern works for about 1 cycle, then crossed to next year, then jumps a year: No. 82 03/01/2017 No. 83 03/31/2017 No. 84 04/30/2017 No. 85 05/30/2017 No. 86 06/29/2017 No. 87 07/29/2017 No. 88 08/28/2017 No. 89 09/27/2017 No. 90 10/27/2017 No. 91 11/26/2017 No. 92 12/26/2017 No. 93 01/25/2018 No. 94 03/01/2019 WRONG!! No. 95 03/31/2019 No. 96 04/30/2019 No. 97 05/30/2019 No. 98 06/29/2019 No. 99 07/29/2019 No. 100 08/28/2019 No. 101 09/27/2019 No. 102 10/27/2019 No. 103 11/26/2019 No. 104 12/26/2019 No. 105 01/25/2020 No. 106 03/01/2021 WRONG!! Seems to be a problem in some cases when we call: ($year) = Add_Delta_YM($year,$month,$day, $freqdata->{"unitsperissue"},0); As this call will always add a year, it ends up in: /usr/share/perl5/Date/Calc/PP.pm sub DateCalc_add_year_month Where we add $year + $freqdata->{"unitsperissue"} and return 1 if it is greater than 1 Suspecting the pass of $freqdata->{"unitsperissue"} is incorrect
Found similar things. Taking a look..
Created attachment 63470 [details] [review] Bug 18356: Extend GetNextDate.t, add GetFictiveIssueNumber.t (unit=year) This patch deals with tests for yearly frequencies. Adjust/extend GetNextDate.t: [1] Adjust mixup of units/issues in a description. [2] Add testing +2 years on 29-2 of leap year for freq 1 issue/2 years. [3] Add tests for freq 9 issues/year. We also include testing the operation of rounding dates to first acquisition day and month when close enough. Add GetFictiveIssueNumber.t: [1] Two subtests are provided for irregular frequencies (very trivial) and for year frequencies (with three specific test cases). Test plan: [1] Run t/db_dependent/Serials/GetNextDate.t [2] Run t/db_dependent/Serials/GetFictiveIssueNumber.t Note: Without the second patch both tests should fail. This shows the need of the adjustments in the second patch. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 63471 [details] [review] Bug 18356: Fix date calculations for yearly frequencies in Serials The problem as described on BZ 18356 is a combination of an error in GetFictiveIssueNumber and GetNextDate for unit==year. In GetFictiveIssueNumber the year should be decreased by one if you have more units per year and you did not yet reach firstacqui day and month. This affects calculations in GetNextDate with irregularities. In GetNextDate the Add_Delta_YM calculation should be applied only to frequencies based on years per unit. In the case of multiple units per year we calculate the number of days to add. And if we have reached the end of a year cycle, we 'round' up to firstacqui day and month as long as we are close enough. Otherwise we just add the number of calculated days, since we can safely assume that the publish dates have been adjusted manually. Test plan: [1] Verify that both GetNextDate.t as well as GetFictiveIssueNumber.t pass. [2] Look at the prediction pattern for a few frequencies. For example: 1 iss/y, 1 iss/2y, 5 iss/y. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Still thinking about an adjustment. Please wait.
Created attachment 63784 [details] [review] Bug 18356: Extend GetNextDate.t, add GetFictiveIssueNumber.t (unit=year) This patch deals with tests for yearly frequencies. Adjust/extend GetNextDate.t: [1] Adjust mixup of units/issues in a description. [2] Add testing +2 years on 29-2 of leap year for freq 1 issue/2 years. [3] Add tests for freq 9 issues/year. Add GetFictiveIssueNumber.t: [1] Two subtests are provided for irregular frequencies (very trivial) and for year frequencies (with four specific test cases). Test plan: [1] Run t/db_dependent/Serials/GetNextDate.t [2] Run t/db_dependent/Serials/GetFictiveIssueNumber.t Note: Without the second patch both tests should fail. This shows the need of the adjustments in the second patch. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 63785 [details] [review] Bug 18356: Fix date calculations for yearly frequencies in Serials The problem as described on BZ 18356 is a combination of an error in GetFictiveIssueNumber and GetNextDate for unit==year. [1] In GetNextDate the Add_Delta_YM calculation should be applied only to frequencies based on years per unit. In the case of multiple units per year we calculate the number of days to add. And if we have reached the end of a cycle, we correct the rounding applied in the cycle. NOTE 1: We obsolete the idea here of rebasing dates on firstacqui. In case of manual adjustments, we probably do not want it. And otherwise we do not need it anymore due to the correction at the end of a cycle. NOTE 2: The calls to Add_Delta_YM are intentionally not corrected for leap years. Say you start at 2016-02-29. If you use 1/yr or 1/2yr, you will switch to the Feb 28th in the following years. In 2020 there will be no switch to Feb 29 again; if someone should need it, please use a manual adjustment. This is probably highly exceptional. [2] In GetFictiveIssueNumber the year should be decreased by one if you have more units per year and you did not yet reach firstacqui day and month. This affects calculations in GetNextDate with irregularities. NOTE: In case of manual adjustments this calculation does not really make sense. Another report should deal with improving irregularities. Test plan: [1] Verify that both GetNextDate.t as well as GetFictiveIssueNumber.t pass. [2] Look at the prediction pattern for a few frequencies. For example: 1 iss/y, 1 iss/2y, 5 iss/y. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Will add links to follow-up reports that handle the other frequencies.
Created attachment 63875 [details] [review] Bug 18356: Extend GetNextDate.t, add GetFictiveIssueNumber.t (unit=year) This patch deals with tests for yearly frequencies. Adjust/extend GetNextDate.t: [1] Adjust mixup of units/issues in a description. [2] Add testing +2 years on 29-2 of leap year for freq 1 issue/2 years. [3] Add tests for freq 9 issues/year. Add GetFictiveIssueNumber.t: [1] Two subtests are provided for irregular frequencies (very trivial) and for year frequencies (with four specific test cases). Test plan: [1] Run t/db_dependent/Serials/GetNextDate.t [2] Run t/db_dependent/Serials/GetFictiveIssueNumber.t Note: Without the second patch both tests should fail. This shows the need of the adjustments in the second patch. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 63876 [details] [review] Bug 18356: Fix date calculations for yearly frequencies in Serials The problem as described on BZ 18356 is a combination of an error in GetFictiveIssueNumber and GetNextDate for unit==year. [1] In GetNextDate the Add_Delta_YM calculation should be applied only to frequencies based on years per unit. In the case of multiple units per year we calculate the number of days to add. And if we have reached the end of a cycle, we correct the rounding applied in the cycle. NOTE 1: We obsolete the idea here of rebasing dates on firstacqui. In case of manual adjustments, we probably do not want it. And otherwise we do not need it anymore due to the correction at the end of a cycle. NOTE 2: The calls to Add_Delta_YM are intentionally not corrected for leap years. Say you start at 2016-02-29. If you use 1/yr or 1/2yr, you will switch to the Feb 28th in the following years. In 2020 there will be no switch to Feb 29 again; if someone should need it, please use a manual adjustment. This is probably highly exceptional. [2] In GetFictiveIssueNumber the year should be decreased by one if you have more units per year and you did not yet reach firstacqui day and month. This affects calculations in GetNextDate with irregularities. NOTE 1: I added a wrapper around Date::Calc::N_Delta_YMD in order to improve its results; this will especially be needed when we use it later for month units. NOTE 2: In case of manual adjustments this calculation does not really make sense. Another report should deal with improving irregularities. Test plan: [1] Verify that both GetNextDate.t as well as GetFictiveIssueNumber.t pass. [2] Look at the prediction pattern for a few frequencies. For example: 1 iss/y, 1 iss/2y, 5 iss/y. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 64021 [details] [review] [SIGNED-OFF] Bug 18356: Extend GetNextDate.t, add GetFictiveIssueNumber.t (unit=year) This patch deals with tests for yearly frequencies. Adjust/extend GetNextDate.t: [1] Adjust mixup of units/issues in a description. [2] Add testing +2 years on 29-2 of leap year for freq 1 issue/2 years. [3] Add tests for freq 9 issues/year. Add GetFictiveIssueNumber.t: [1] Two subtests are provided for irregular frequencies (very trivial) and for year frequencies (with four specific test cases). Test plan: [1] Run t/db_dependent/Serials/GetNextDate.t [2] Run t/db_dependent/Serials/GetFictiveIssueNumber.t Note: Without the second patch both tests should fail. This shows the need of the adjustments in the second patch. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 64022 [details] [review] [SIGNED-OFF] Bug 18356: Fix date calculations for yearly frequencies in Serials The problem as described on BZ 18356 is a combination of an error in GetFictiveIssueNumber and GetNextDate for unit==year. [1] In GetNextDate the Add_Delta_YM calculation should be applied only to frequencies based on years per unit. In the case of multiple units per year we calculate the number of days to add. And if we have reached the end of a cycle, we correct the rounding applied in the cycle. NOTE 1: We obsolete the idea here of rebasing dates on firstacqui. In case of manual adjustments, we probably do not want it. And otherwise we do not need it anymore due to the correction at the end of a cycle. NOTE 2: The calls to Add_Delta_YM are intentionally not corrected for leap years. Say you start at 2016-02-29. If you use 1/yr or 1/2yr, you will switch to the Feb 28th in the following years. In 2020 there will be no switch to Feb 29 again; if someone should need it, please use a manual adjustment. This is probably highly exceptional. [2] In GetFictiveIssueNumber the year should be decreased by one if you have more units per year and you did not yet reach firstacqui day and month. This affects calculations in GetNextDate with irregularities. NOTE 1: I added a wrapper around Date::Calc::N_Delta_YMD in order to improve its results; this will especially be needed when we use it later for month units. NOTE 2: In case of manual adjustments this calculation does not really make sense. Another report should deal with improving irregularities. Test plan: [1] Verify that both GetNextDate.t as well as GetFictiveIssueNumber.t pass. [2] Look at the prediction pattern for a few frequencies. For example: 1 iss/y, 1 iss/2y, 5 iss/y. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 64310 [details] [review] Bug 18356: Extend GetNextDate.t, add GetFictiveIssueNumber.t (unit=year) This patch deals with tests for yearly frequencies. Adjust/extend GetNextDate.t: [1] Adjust mixup of units/issues in a description. [2] Add testing +2 years on 29-2 of leap year for freq 1 issue/2 years. [3] Add tests for freq 9 issues/year. Add GetFictiveIssueNumber.t: [1] Two subtests are provided for irregular frequencies (very trivial) and for year frequencies (with four specific test cases). Test plan: [1] Run t/db_dependent/Serials/GetNextDate.t [2] Run t/db_dependent/Serials/GetFictiveIssueNumber.t Note: Without the second patch both tests should fail. This shows the need of the adjustments in the second patch. 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>
Created attachment 64311 [details] [review] Bug 18356: Fix date calculations for yearly frequencies in Serials The problem as described on BZ 18356 is a combination of an error in GetFictiveIssueNumber and GetNextDate for unit==year. [1] In GetNextDate the Add_Delta_YM calculation should be applied only to frequencies based on years per unit. In the case of multiple units per year we calculate the number of days to add. And if we have reached the end of a cycle, we correct the rounding applied in the cycle. NOTE 1: We obsolete the idea here of rebasing dates on firstacqui. In case of manual adjustments, we probably do not want it. And otherwise we do not need it anymore due to the correction at the end of a cycle. NOTE 2: The calls to Add_Delta_YM are intentionally not corrected for leap years. Say you start at 2016-02-29. If you use 1/yr or 1/2yr, you will switch to the Feb 28th in the following years. In 2020 there will be no switch to Feb 29 again; if someone should need it, please use a manual adjustment. This is probably highly exceptional. [2] In GetFictiveIssueNumber the year should be decreased by one if you have more units per year and you did not yet reach firstacqui day and month. This affects calculations in GetNextDate with irregularities. NOTE 1: I added a wrapper around Date::Calc::N_Delta_YMD in order to improve its results; this will especially be needed when we use it later for month units. NOTE 2: In case of manual adjustments this calculation does not really make sense. Another report should deal with improving irregularities. Test plan: [1] Verify that both GetNextDate.t as well as GetFictiveIssueNumber.t pass. [2] Look at the prediction pattern for a few frequencies. For example: 1 iss/y, 1 iss/2y, 5 iss/y. 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>
Pushed to master for 17.11, thanks to everybody involved!
*** Bug 16116 has been marked as a duplicate of this bug. ***
Pushed to 17.05.x, will be in 17.05.02
These patches have been pushed to 16.11.x and will be in 16.11.10.
Pushed to 16.05.x, for 16.05.15 release