Bug 22813: remove repetitive queries inside two nested loops in searchResults
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 30 Apr 2019 15:30:25 +0000 (12:30 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 7 May 2019 10:58:17 +0000 (10:58 +0000)
commit10efe4e3f239c47b847c53f06f82245e07d54759
tree4d04839544e0e110c35a2124e7f7cd55bd0b7623
parentc1513a10c35f721e3c519d5ab3c38c7154b7fa1c
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>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
C4/Search.pm