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)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 23 Sep 2014 20:52:12 +0000 (20:52 +0000)
commit31f808cb49e13b75b4137b3adb681135f8a1e51f
tree1e056206fbb771bca7b3deae9b0d36c9a81ee7ec
parent9f2c4b78261b2be1d4a09dd9dfcf0eef75acb308
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>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Search.pm
t/db_dependent/Search.t