[Koha-bugs] [Bug 24254] Add Koha::Items->filter_by_visible_in_opac

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Dec 18 13:26:44 CET 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24254

--- Comment #18 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
(In reply to Jonathan Druart from comment #17)
> (In reply to Tomás Cohen Arazi from comment #15)
> > (In reply to Jonathan Druart from comment #13)
> > > Why does the method take rules in parameter? Why don't we simply build the
> > > rules from the pref in the method?
> > 
> > If it was called in a loop, we could reuse the rules. That was the idea.
> > Maybe we should read the rules locally if the parameter was not passed at
> > all (i.e. !exists $params->{rules}).
> 
> What for? Performance?
> If we are looping on biblios then it's not that reading the pref and
> building the rules that will have an impact on perf. If you are concerned
> about that I would cache it at package level (->{_item_hide_rules}).
> 
> I think it's better to prevent calls that will forget to pass the rules, or
> having to update all the callers if we decide to add one rules.
> 
> What do you think?

I usually prefer explicit vs. implicit. But not a strong position on this
particular case. The 'if passed use it, if not, read it' approach seems to me
like the best compromise option. This could be a follow-up bug (it requires new
tests, probably adapt the callers)

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list