Bug 12788: (followup) minor optimization with proper tests
authorTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 20 Aug 2014 14:39:27 +0000 (11:39 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 5 Sep 2014 19:38:39 +0000 (16:38 -0300)
commitead0d88c74bd0efba2d2ca0123c51ff2b6cf25fc
tree5a8aefcfee9b246d0ea2955186ed51c285fbf9cc
parenteefef42abda81e84e42d4a3951684092045886fa
Bug 12788: (followup) minor optimization with proper tests

This patch removes the $facets_info calculation from the _get_facets_data_from_record
sub so it is not done for each record. It introduces a new sub, _get_facets_info
that is called from the getRecords loop, that does the job only once.

To test:
- Apply on top of the previous patches
- Run
  $ prove -v t/db_dependent/Search.t
=> SUCCESS: _get_facets_info gets tested and it passes for both MARC21 and UNIMARC.
  Facets rendering should remain unchaged on the UI.
- Sign off :-D

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Search.pm
t/db_dependent/Search.t