Created attachment 30291 [details] [review] Bug 12671: Refactor GetNextDate
Created attachment 30292 [details] [review] Bug 12671: Guess next serial date when there are several issues per unit This guess uses the following algorithm 1/ Get the number of days remaining from first issue of this unit of time until the end of the unit of time (using 7 days for week, 28 for month and 365 for year) 2/ Divide it by the number of issues per unit 3/ Take the integer part of the result, this is the number of days to add to previous serial published date This patch also try to guess the date of the first issue of a unit of time. Before that, it was: - for week: monday of week - for month: 1st day of month - for year: 1st day of year Now it uses firstacquidate. Example: firstacquidate = 1970-01-07 (wednesday) unit = week issuesperunit = 2 (2 issues per week) From wednesday to sunday, there are 4 days so we add 2 days to get the next date. The next dates should be: - 1970-01-09 (+ 2 days) - 1970-01-14 (wednesday of next week) - 1970-01-16 (+ 2 days) - ... and so on Test plan: 1/ Go to numbering pattern creation page (Serials -> Manager numbering patterns -> New numbering pattern) 2/ In "Test prediction pattern" fieldset, set subscription length to 50 issues (this avoid to compute the next 1000 dates, which can take time) 3/ Fill first issue publication date 4/ Choose the frequency you want to test 5/ click on "Test pattern" button 6/ Check that the dates are correct 7/ Repeat steps 3-7 until you think you have tested enough cases Interesting frequencies to test: - 1/day - 1/week - 2/week - 6/week (firstacquidate should be monday or tuesday, or the generated dates will be the same for all the week) - 1/month - 2/month - 3/month - 1/year - 2/year - 3/year
Created attachment 34658 [details] [review] Bug 12671: Guess next serial date when there are several issues per unit. Added support for real month and year lenghts. When getting the next frequency number, use the real number of days for each month and each year. Unit tests updated.
Thanks for the awesome patch! I am pushing this to production and getting feedback from our Serials people. We are just inserting our subscriptions using the Koha's serials-module.
Created attachment 34659 [details] [review] Bug 12671: Refactor GetNextDate A much needed refactoring. Thanks for seeing the effort through. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Created attachment 34660 [details] [review] Bug 12671: Guess next serial date when there are several issues per unit This guess uses the following algorithm 1/ Get the number of days remaining from first issue of this unit of time until the end of the unit of time (using 7 days for week, 28 for month and 365 for year) 2/ Divide it by the number of issues per unit 3/ Take the integer part of the result, this is the number of days to add to previous serial published date This patch also try to guess the date of the first issue of a unit of time. Before that, it was: - for week: monday of week - for month: 1st day of month - for year: 1st day of year Now it uses firstacquidate. Example: firstacquidate = 1970-01-07 (wednesday) unit = week issuesperunit = 2 (2 issues per week) From wednesday to sunday, there are 4 days so we add 2 days to get the next date. The next dates should be: - 1970-01-09 (+ 2 days) - 1970-01-14 (wednesday of next week) - 1970-01-16 (+ 2 days) - ... and so on Test plan: 1/ Go to numbering pattern creation page (Serials -> Manager numbering patterns -> New numbering pattern) 2/ In "Test prediction pattern" fieldset, set subscription length to 50 issues (this avoid to compute the next 1000 dates, which can take time) 3/ Fill first issue publication date 4/ Choose the frequency you want to test 5/ click on "Test pattern" button 6/ Check that the dates are correct 7/ Repeat steps 3-7 until you think you have tested enough cases Interesting frequencies to test: - 1/day - 1/week - 2/week - 6/week (firstacquidate should be monday or tuesday, or the generated dates will be the same for all the week) - 1/month - 2/month - 3/month - 1/year - 2/year - 3/year ---------------- Sign off report: ---------------- -Followed the test plan. Unit tests work. Also trying some more strange frequencies with our librarians: 5/year, 43/year, 10/year. -Received all serials for a subscription and found no errors. -Received some serials with frequency 2/month pre-patch, getting publication date as 1st of every month for each magazine. Having applied the patch, publication dates started working mid-subscription for new magazines. -Works well and fine! Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Changed status to signed off
I am sorry, patches no longer apply on current master: Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 12671: Guess next serial date when there are several issues per unit. Added support for real month and year lenghts. fatal: sha1 information is lacking or useless (C4/Serials.pm). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 Bug 12671: Guess next serial date when there are several issues per unit. Added support for real month and year lenghts. The copy of the patch that failed is found in: /home/katrin/kohaclone/.git/rebase-apply/patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-12671-Guess-next-serial-date-when-there-are-se-UWVsuV.patch
Created attachment 36924 [details] [review] Bug 12671: Refactor GetNextDate Rebased on master
Created attachment 36925 [details] [review] Bug 12671: Guess next serial date when there are several issues per unit Rebased on master
Created attachment 36926 [details] [review] Bug 12671: Guess next serial date when there are several issues per unit. Added support for real month and year lenghts. Rebased on master
Patches applied well on master, but were in the wrong order. Anyway, patches rebased and reordered.
This works well in production for 4 months already. Somebody should push this to master asap!
Created attachment 37340 [details] [review] [PASSED QA] Bug 12671: Refactor GetNextDate A much needed refactoring. Thanks for seeing the effort through. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 37341 [details] [review] [PASSED QA] Bug 12671: Guess next serial date when there are several issues per unit This guess uses the following algorithm 1/ Get the number of days remaining from first issue of this unit of time until the end of the unit of time (using 7 days for week, 28 for month and 365 for year) 2/ Divide it by the number of issues per unit 3/ Take the integer part of the result, this is the number of days to add to previous serial published date This patch also try to guess the date of the first issue of a unit of time. Before that, it was: - for week: monday of week - for month: 1st day of month - for year: 1st day of year Now it uses firstacquidate. Example: firstacquidate = 1970-01-07 (wednesday) unit = week issuesperunit = 2 (2 issues per week) From wednesday to sunday, there are 4 days so we add 2 days to get the next date. The next dates should be: - 1970-01-09 (+ 2 days) - 1970-01-14 (wednesday of next week) - 1970-01-16 (+ 2 days) - ... and so on Test plan: 1/ Go to numbering pattern creation page (Serials -> Manager numbering patterns -> New numbering pattern) 2/ In "Test prediction pattern" fieldset, set subscription length to 50 issues (this avoid to compute the next 1000 dates, which can take time) 3/ Fill first issue publication date 4/ Choose the frequency you want to test 5/ click on "Test pattern" button 6/ Check that the dates are correct 7/ Repeat steps 3-7 until you think you have tested enough cases Interesting frequencies to test: - 1/day - 1/week - 2/week - 6/week (firstacquidate should be monday or tuesday, or the generated dates will be the same for all the week) - 1/month - 2/month - 3/month - 1/year - 2/year - 3/year ---------------- Sign off report: ---------------- -Followed the test plan. Unit tests work. Also trying some more strange frequencies with our librarians: 5/year, 43/year, 10/year. -Received all serials for a subscription and found no errors. -Received some serials with frequency 2/month pre-patch, getting publication date as 1st of every month for each magazine. Having applied the patch, publication dates started working mid-subscription for new magazines. -Works well and fine! Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 37342 [details] [review] [PASSED QA] Bug 12671: Guess next serial date when there are several issues per unit. Added support for real month and year lenghts. When getting the next frequency number, use the real number of days for each month and each year. Unit tests updated. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Patches pushed to master. Good job Julian!