[Bug 42500] New: Update hold ratios (reserveratios.pl) to fetch data via API
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 Bug ID: 42500 Summary: Update hold ratios (reserveratios.pl) to fetch data via API Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Hold requests Assignee: koha-bugs@lists.koha-community.org Reporter: andrew@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, lisette@bywatersolutions.com, tomascohen@gmail.com The Hold Ratios page is a pain point for larger systems with many holds. We should update how it fetches, displays, and interacts with data. -- 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=42500 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42643 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42643 [Bug 42643] [OMNIBUS] Assorted performance and stability work -- 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=42500 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com Assignee|koha-bugs@lists.koha-commun |kyle@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 --- Comment #1 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 201437 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201437&action=edit Bug 42500: Add filter_by_pending to Koha::Acquisition::Orders The hold ratios report needs to know how many copies are still on order for a biblio. This adds a filter_by_pending method to Koha::Acquisition::Orders returning the orders that have not been cancelled and still have copies left to receive ( quantityreceived less than quantity ), matching the criteria the old CountPendingOrdersByBiblionumber used. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 --- Comment #2 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 201438 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201438&action=edit Bug 42500: Add unit tests for filter_by_pending Patch from commit 7fa3e6e -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 --- Comment #3 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 201439 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201439&action=edit Bug 42500: Add Koha::Holds->hold_ratios method This moves the hold ratios aggregation out of the REST controller into a Koha::Holds->hold_ratios class method so it can be unit tested directly. The ratio is computed in SQL and filtered with a HAVING clause, so the database returns only the qualifying biblios and the report can be paginated. The method returns the holds and items counts, the ratio, the number of copies to buy and the library, item type and authorised value codes of the biblio's items, along with the total number of qualifying biblios. Resolving the codes to names is left to the caller. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 --- Comment #4 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 201440 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201440&action=edit Bug 42500: Add unit tests for hold_ratios Patch from commit 68d8d80 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 --- Comment #5 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 201441 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201441&action=edit Bug 42500: Add REST API for hold ratios The hold ratios page ( reserveratios.pl ) builds its entire result set in Perl and renders every matching row, which is a pain point for larger systems with many holds. This patch adds a /holds/ratios REST endpoint so the page can fetch the data and paginate it. The hold ratio is computed in SQL and the ratio threshold is applied as a HAVING clause, so the database returns only the biblios that meet the ratio and the endpoint returns one page at a time instead of the whole set. Each row carries the computed holds_count, items_count, hold_ratio, copies_to_buy and the count of copies still on order, along with the home and holding libraries, locations, item types, collections and call numbers of the biblio's items. The old page adjusted the item count when it was reached from an acquisitions basket that creates items on receiving. That adjustment is dropped here; the pending order count is still returned separately. Test Plan: 1) Apply this patch 2) Restart all the things! 3) Place several holds on a biblio that has fewer items than holds 4) curl the endpoint as a librarian with circulate permission: curl -s -u koha:koha "http://localhost:8081/api/v1/holds/ratios?ratio=1" | json_pp 5) Note the biblio is returned with its hold ratio, items needed and item details! 6) Try ratio=99, note the biblio is filtered out! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 --- Comment #6 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 201442 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201442&action=edit Bug 42500: Update hold ratios page to fetch data via the API The page used to run the hold ratios query and render every matching row, then hand the full table to DataTables to page through in the browser. On larger systems with many holds that means loading the whole result set on every visit. This patch turns the table into a server side DataTable that fetches from the /holds/ratios API, so only one page of rows is loaded at a time. The sidebar form still drives the ratio and date filters; it reloads the page and seeds the table's API request. The libraries, item types, locations and collections come back ready to display, and the title link, item lists and "to order" button are rendered in the browser. Test Plan: 1) Apply this patch 2) Restart all the things! 3) Place several holds on a biblio with fewer items than holds 4) Go to Circulation -> Hold ratios 5) Note the biblio is listed with its hold ratio, libraries, item types and items needed! 6) Change the hold ratio filter and the dates, click Go 7) Note the list updates to match! 8) Sort by Holds, Items, Hold ratio and Items needed 9) Note the sorting works across pages! 10) Reach the page from an acquisitions basket ( with a vendor and basket in the URL ) 11) Note the "N to order" button links into a new order! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 --- Comment #7 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 201443 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201443&action=edit Bug 42500: Add unit tests REST API endpoint list_ratios Patch from commit 17836ad -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43017 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43017 [Bug 43017] [OMNIBUS] Interface optimization -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|42643 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42643 [Bug 42643] [OMNIBUS] Assorted performance and stability work -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org