https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41294
--- Comment #11 from Matt Blenkinsop <[email protected]> --- Created attachment 210197 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210197&action=edit Bug 41294: Split harvest period into monthly jobs A harvest over several months ran as one background job and one SUSHI request. Providers serve usage per month, a failure in one month lost the whole range, and the counter log held one row for the range so a month could not be retried on its own. Koha::ERM::EUsage::UsageDataProvider->harvest_periods splits a date range into one period per calendar month: the first period starts on the begin date, the last ends on the end date, equal dates give one period. The dates are calendar days in the floating time zone, so the split does not depend on the server time zone or on daylight saving. An end date after today is reduced to today; a begin date after today throws BadParameter. enqueue_sushi_harvest_jobs enqueues one job per report type and month and returns the jobs with their report type and period. The process_SUSHI_response API returns that list, accepts equal dates, and answers 400 with the message of a BadParameter exception. Test plan: 1. On the data providers list, click "Run now" for a provider and ask for a period of three months. The message lists, per report type, "3 jobs queued for report type TR_J1" with one link per month 2. Click a month link: the background job page shows the report type and the harvest period of that month only, with one month of data 3. Go to E-resource management > Home: the "Latest SUSHI Counter jobs" widget shows the three jobs with a "Report type" and a "Period" column 4. Let one month fail (for example disable the network during the harvest): the failed job page names the report type and the period, and the other months still finish 5. Run the cronjob: misc/cronjobs/erm_run_harvester.pl --begin-date 2024-01-01 \ --end-date 2024-03-31 --dry-run It lists, per provider and report type, the three monthly periods that would be enqueued and enqueues nothing 6. Run it without --dry-run: it reports the jobs it enqueued per report type with their month range and job ids, and the jobs appear in the widget 7. Run it with --begin-date set to a date after today: the script stops with an error message and enqueues nothing 8. Run it with --end-date in the future: the end date is reduced to today and no error is reported 9. prove -l t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t \ t/db_dependent/api/v1/erm_usage_data_providers.t \ t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t 10. yarn cypress run --spec t/cypress/integration/ERM/DataProviders_spec.ts yarn cypress run --spec t/cypress/integration/ERM/ModuleDashboard_spec.ts Sponsored-by: Karlsruhe Institute of Technology (KIT) Assisted-by: Sonnet 5 (Anthropic) -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
