Bug 39819 - Additional performance improvements when loading borrower relationships.
Summary: Additional performance improvements when loading borrower relationships.
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 39644
Blocks:
  Show dependency treegraph
 
Reported: 2025-05-02 14:47 UTC by Lucas Gass (lukeg)
Modified: 2025-05-05 00:35 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2025-05-02 14:47:59 UTC
From Nick via Bug 39644:

I think there is more cleanup to be done here.

relationships_debt is only called twice in the code base:
once in moremember.pl
once in Koha::Patron->is_patron_inside_charge_limits (which is also called in moremember)

The two calls are:
 - moremember:
   $patron->relationships_debt( { include_guarantors => 0, only_this_guarantor => 1, include_this_patron => 1 } );
 - is_patron_inside_charge_limits:
   $patron->relationships_debt( { include_guarantors => 1, only_this_guarantor => 0, include_this_patron => 1 } );

The difference being that the first returns only the single patrons fine + their guarantees, the latter returns the patron and thier gusarantees and the guarantees other guarantors

The first being a subset of the second, we should be able to return this additional info from "is_patron_inside_charge_limits" and avoid a double call.

Additionally, moremember does checks against "NoIssuesChargeGuarantorsWithGuarantees" and "NoIssuesChargeGuarantees" - both of which are checked inside "is_patron_inside_charge_limits" so we can simply use values we are already calculating and not calculate them again