https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33080 --- Comment #6 from Agustín Moyano <agustinmoyano@theke.io> --- (In reply to Martin Renvoize from comment #4)
Comment on attachment 147662 [details] [review] Bug 33080: Introduce objects.search_rs, objects.find_rs and objects.to_api
Review of attachment 147662 [details] [review]: -----------------------------------------------------------------
::: Koha/REST/Plugin/Objects.pm @@ +243,3 @@
# Perform search my $objects = $result_set->search( $filtered_params, $attributes );
I think we need to rework the pagination handling a little for this change. We can't really keep it inside this method now that it returns a resultset that we're expecting developers to then further filter and refine.
I think we should update the add_pagination_headers helper to accept a resultset.. it can then build the total and base_total fields itself by executing the count and looking at the pager in the resultset passed.
We could then call this automatically in the non-rs search header above and document that it should be called by the developer in their controller after they've applied their own additional filtering etc in the controller if they're using the _rs helper.
For this.. I'm failing QA.. But I do really like where this is headed.
Hi Martin, thanks for pointing this out... I do not believe we should change the add_pagination_headers helper, it really wouldn't change much of how we should call it. And it's actually called by some controllers, so we should change those also. Now we are calling it with base_total, total, and params... but if we change it to resultsets we should call it with filtered_resultset (to get total), unfiltered_resultset (to get base_total), and params. What I'll do is remove the add_pagination_headers call from objects->search_rs as you mentioned, and put that in objects->search instead. Cheers -- You are receiving this mail because: You are watching all bug changes.