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

--- Comment #9 from Matt Blenkinsop <[email protected]> ---
Created attachment 204011
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204011&action=edit
Bug 43126: Add an endpoint for determining batch holdability

Adds POST /biblios/{biblio_id}/holdability/batch, which reports a verdict for
each patron in one call, or for each patron and item pair when item_ids is
given.

The record's item list is read once for the whole request rather than once per
patron, which is what the club hold case needs.

An id that cannot be resolved becomes an entry carrying an error_code rather
than failing the request, so one stale id in a club does not cost the caller
every other verdict.

Assisted-by: Sonnet 5 (Anthropic)

Test plan:

Preparation

 1) Apply the patches.

 2) Run:
      yarn api:bundle && restart_all

Test suite

 3) Run the new and changed tests. All should pass. These are what covers the
    five new endpoints, which have no interface yet:
      prove t/Koha/Result/Availability.t
      prove t/db_dependent/QueryCounter.t
      prove t/db_dependent/Koha/CirculationRules.t
      prove t/db_dependent/Koha/Biblio/Availability/Hold.t
      prove t/db_dependent/api/v1/patrons_hold_eligibility.t
      prove t/db_dependent/api/v1/items_holdability.t
      prove t/db_dependent/api/v1/biblios_holdability.t
      prove t/db_dependent/api/v1/biblios_holdability_batch.t
      prove t/db_dependent/api/v1/biblios.t

 4) Run the tests that cover what the patches touch but do not add. All should
    pass:
      prove xt/api.t
      prove t/db_dependent/Circulation.t
      prove t/db_dependent/Circulation/TooMany.t
      prove t/db_dependent/Reserves.t
      prove t/db_dependent/Holds.t
      prove t/db_dependent/Koha/Items.t
      prove t/db_dependent/Koha/Item/Availability/Hold.t
      prove t/db_dependent/Koha/Patron/Availability/Hold.t
      prove t/db_dependent/Koha/Club/Hold.t
      prove t/db_dependent/Koha/Patron.t
      prove t/db_dependent/api/v1/holds.t
      prove t/db_dependent/api/v1/clubs_holds.t
      prove t/db_dependent/api/v1/items.t
      prove t/db_dependent/api/v1/patrons.t

Holds must still work

    The patches change Koha::Biblio::Availability::Hold and
    Koha::Item::Availability::Hold, which sit behind every hold in Koha.

 5) Place a hold on a record from the staff interface. It should succeed as
    before.

 6) Place a hold from the OPAC. It should succeed as before.

 7) Restrict a patron, then try to place a hold for them in the staff
    interface. It should still be refused, with the same message as before the
    patches.

Circ rules must still take effect

    One patch changes how circulation rule values are cached within a request,
    so that a rule whose value is zero or blank is cached rather than re-read
    every time. Confirm that a rule change is still noticed at once.

 8) Administration > Circulation and fines rules. Set "Holds allowed (total)"
    to 0 for a rule that applies to your test patron and item.

 9) Try to place a hold. It should be refused.

10) Set "Holds allowed (total)" back to a number above 0 and save.

11) Try again. The hold should now be allowed, with no need to restart Plack or
    wait. This is the case the caching patch has to get right: the earlier
    value was false, and a false value now stays in the cache until a write
    clears it.

12) Delete that rule row entirely and repeat. The effective rule should fall
    back to the next matching one straight away.

Performance

13) Run the benchmark and read the tables it prints:
      prove -v t/db_dependent/api/v1/holdability_benchmark.t
    The first table is the present-day cost of CanBookBeReserved plus a
    CanItemBeReserved loop. The rest are the new endpoints. The record-level
    endpoint should show the same query count for a record of 10 items and one
    of 500.

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