Summary: | searchResults queries the Koha::Patron object inside two nested loops | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | Architecture, internals, and plumbing | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | CLOSED FIXED | QA Contact: | Martin Renvoize (ashimema) <martin.renvoize> |
Severity: | normal | ||
Priority: | P5 - low | CC: | jonathan.druart, josef.moravec, lucas, martin.renvoize, nick |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
19.05.00, 18.11.06
|
|
Circulation function: | |||
Attachments: |
Bug 22813: remove repetitive queries inside two nested loops in searchResults
Bug 22813: remove repetitive queries inside two nested loops in searchResults Bug 22813: (follow-up) Add missing condition Bug 22813: remove repetitive queries inside two nested loops in searchResults Bug 22813: (follow-up) Add missing condition |
Description
Tomás Cohen Arazi (tcohen)
2019-04-30 15:22:04 UTC
Created attachment 89137 [details] [review] Bug 22813: remove repetitive queries inside two nested loops in searchResults This patch moves a query on Koha::Patrons and then the related Koha::Patron::Category that needlessly happens inside two nested loops (all items of all MARC records in the resultset). The Koha::Patron and Koha::Patron::Category are always the same as it is fetched from C4::Context->userenv each time. To test: - Run: $ kshell k$ prove t/db_dependent/Search.t => SUCCESS: Tests pass - Apply this patch - Run: k$ prove t/db_dependent/Search.t => SUCCESS: Tests still pass! - Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Created attachment 89150 [details] [review] Bug 22813: remove repetitive queries inside two nested loops in searchResults This patch moves a query on Koha::Patrons and then the related Koha::Patron::Category that needlessly happens inside two nested loops (all items of all MARC records in the resultset). The Koha::Patron and Koha::Patron::Category are always the same as it is fetched from C4::Context->userenv each time. To test: - Run: $ kshell k$ prove t/db_dependent/Search.t => SUCCESS: Tests pass - Apply this patch - Run: k$ prove t/db_dependent/Search.t => SUCCESS: Tests still pass! - Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Liz Rea <wizzyrea@gmail.com> Created attachment 89151 [details] [review] Bug 22813: (follow-up) Add missing condition This patch restores a missing condition. $patron gets renamed to make it obvious that it related to the logged in user. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Created attachment 89220 [details] [review] Bug 22813: remove repetitive queries inside two nested loops in searchResults This patch moves a query on Koha::Patrons and then the related Koha::Patron::Category that needlessly happens inside two nested loops (all items of all MARC records in the resultset). The Koha::Patron and Koha::Patron::Category are always the same as it is fetched from C4::Context->userenv each time. To test: - Run: $ kshell k$ prove t/db_dependent/Search.t => SUCCESS: Tests pass - Apply this patch - Run: k$ prove t/db_dependent/Search.t => SUCCESS: Tests still pass! - Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 89221 [details] [review] Bug 22813: (follow-up) Add missing condition This patch restores a missing condition. $patron gets renamed to make it obvious that it related to the logged in user. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Well spotted! Passing QA Awesome work all! Pushed to master for 19.05 Pushed to 18.11.x for 18.11.06 backported to 18.05.x for 18.05.13 |