Bugzilla – Attachment 147720 Details for
Bug 33080
Add helpers that return result_set for further processing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33080: (follow-up) Move pagination logic out of search_rs
Bug-33080-follow-up-Move-pagination-logic-out-of-s.patch (text/plain), 1.94 KB, created by
Agustín Moyano
on 2023-03-03 17:36:27 UTC
(
hide
)
Description:
Bug 33080: (follow-up) Move pagination logic out of search_rs
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2023-03-03 17:36:27 UTC
Size:
1.94 KB
patch
obsolete
>From 1a7229e54e9f112b43c727e351a13a860c843f21 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Fri, 3 Mar 2023 14:35:45 -0300 >Subject: [PATCH] Bug 33080: (follow-up) Move pagination logic out of search_rs > >--- > Koha/REST/Plugin/Objects.pm | 30 ++++++++++++++++-------------- > 1 file changed, 16 insertions(+), 14 deletions(-) > >diff --git a/Koha/REST/Plugin/Objects.pm b/Koha/REST/Plugin/Objects.pm >index 462fdf97da..ff56341502 100644 >--- a/Koha/REST/Plugin/Objects.pm >+++ b/Koha/REST/Plugin/Objects.pm >@@ -114,7 +114,22 @@ shouldn't be called twice in it. > 'objects.search' => sub { > my ( $c, $result_set ) = @_; > >- return $c->objects->to_api( $c->objects->search_rs($result_set) ); >+ my $objects = $c->objects->search_rs($result_set); >+ my $total = $result_set->search->count; >+ >+ $c->add_pagination_headers( >+ { >+ total => ( >+ $objects->is_paged >+ ? $objects->pager->total_entries >+ : $objects->count >+ ), >+ base_total => $total, >+ params => $args, >+ } >+ ); >+ >+ return $c->objects->to_api( $objects ); > } > ); > >@@ -246,19 +261,6 @@ shouldn't be called twice in it. > > # Perform search > my $objects = $result_set->search( $filtered_params, $attributes ); >- my $total = $result_set->search->count; >- >- $c->add_pagination_headers( >- { >- total => ( >- $objects->is_paged >- ? $objects->pager->total_entries >- : $objects->count >- ), >- base_total => $total, >- params => $args, >- } >- ); > > return $objects; > } >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33080
:
147469
|
147662
|
147663
|
147720
|
147734
|
147735
|
147736
|
147788
|
147789
|
147790
|
147823
|
147824
|
147825
|
148020
|
148021
|
148022
|
148071
|
148072
|
148073