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

--- Comment #2 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 202394
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202394&action=edit
Bug 43124: Reuse the item fetch across club-hold members

Koha::Club::Hold::add called CanBookBeReserved once (or twice, with
default_patron_home) per enrolled member, and each call independently
re-fetched the biblio's full item list (plus host/analytics items) via
Koha::Biblio::Availability::Hold - the same list every time, since it
doesn't depend on which member is being checked.

Added an optional 'items' param to Koha::Biblio::Availability::Hold->check
(and threaded through CanBookBeReserved) that skips its own item/host-item
fetch when a pre-fetched list is supplied. Exposed the fetch itself as a
new Koha::Biblio::Availability::Hold->fetch_items class method so
Koha::Club::Hold::add can call it once before the member loop and pass the
result to every CanBookBeReserved call.

Added a query-count test confirming the item-table query issued by the
availability check doesn't scale with club member count.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
   k$ prove t/db_dependent/Koha/Club/Hold.t t/db_dependent/api/v1/clubs_holds.t
=> SUCCESS: All tests pass, including the new query-count assertion!
3. Sign off :-D

-- 
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/

Reply via email to