[Koha-bugs] [Bug 31051] Show patron's 'savings' on the OPAC
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Feb 9 15:35:28 CET 2023
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31051
--- Comment #42 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Created attachment 146431
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146431&action=edit
Bug 31051: (QA follow-up) Use a single query and avoid duplicated sums
This patch makes the `get_savings` method use a single query to
calculate the sum of the replacement prices. This way we save one query
per item and just rely on the DB features.
It has a side effect: we are not summing items twice.
Added tests for the 'itenumber is null' pathological but common use
case (specially in old_issues), as mentioned by Lucas. Handling for this
is added (grep filtering out undefined ones) and also in the return, for
the empty case, with // 0.
To test:
1. Apply this patch
2. Run:
qa -c 6 --run-tests
=> SUCCESS: All good
3. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen at theke.io>
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list