https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42500

--- Comment #5 from Kyle M Hall (khall) <[email protected]> ---
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.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to