[Bug 22813] New: searchResults queries the Koha::Patron object inside two nested loops
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Bug ID: 22813 Summary: searchResults queries the Koha::Patron object inside two nested loops Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- I haven't benchmarked this, but it seems really bad and easy to fix. To verify: Go to C4::Search:2119, notice the IF includes a query for a Koha::Patron object, and then for its related Koha::Patron::Category object. This is done for each item, on each record in the resultset WTF -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org, | |josef.moravec@gmail.com, | |martin.renvoize@ptfs-europe | |.com, | |nick@bywatersolutions.com Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 89137 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=89137&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Liz Rea <wizzyrea@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Liz Rea <wizzyrea@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #89137|0 |1 is obsolete| | --- Comment #2 from Liz Rea <wizzyrea@gmail.com> --- Created attachment 89150 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=89150&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 89151 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=89151&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #89150|0 |1 is obsolete| | --- Comment #4 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 89220 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=89220&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #89151|0 |1 is obsolete| | --- Comment #5 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 89221 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=89221&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Well spotted! Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@ptfs-europe |y.org |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #7 from Nick Clemens <nick@bywatersolutions.com> --- Awesome work all! Pushed to master for 19.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |19.05.00, 18.11.06 released in| | Status|Pushed to Master |Pushed to Stable --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Pushed to 18.11.x for 18.11.06 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22813 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com --- Comment #9 from Lucas Gass <lucas@bywatersolutions.com> --- backported to 18.05.x for 18.05.13 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org