[Bug 27353] New: Return the number of total records
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Bug ID: 27353 Summary: Return the number of total records Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: ASSIGNED Severity: enhancement Priority: P5 - low Component: REST API Assignee: jonathan.druart@bugs.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org We already set X-Total-Count to the total number of filtered rows, but we don't have the total number of non-filtered rows. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 114893 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=114893&action=edit Bug 27353: Set X-Base-Total-Count header for REST API We already set X-Total-Count to the total number of filtered rows, but we don't have the total number of non-filtered rows. Test plan: This is easy to test on top of bug 27352 or bug 27251, apply them if not pushed yet. 1. Create 40 items with public notes = "xxx" for biblionumber=4 then, using Postman (or whatever you prefer): http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains Check the headers and confirm you see X-Total-Count=40 and X-Base-Total-Count=44 2. go to /cgi-bin/koha/tools/quotes.pl You see "Showing 1 to 20 of 28 entries" Search "he" Showing 1 to 20 of 22 entries (filtered from 28 total entries) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #114893|0 |1 is obsolete| | --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 114896 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=114896&action=edit Bug 27353: Set X-Base-Total-Count header for REST API We already set X-Total-Count to the total number of filtered rows, but we don't have the total number of non-filtered rows. Test plan: This is easy to test on top of bug 27352 or bug 27251, apply them if not pushed yet. 1. Create 40 items with public notes = "xxx" for biblionumber=4 then, using Postman (or whatever you prefer): http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains Check the headers and confirm you see X-Total-Count=40 and X-Base-Total-Count=44 2. go to /cgi-bin/koha/tools/quotes.pl You see "Showing 1 to 20 of 28 entries" Search "he" Showing 1 to 20 of 22 entries (filtered from 28 total entries) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 114897 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=114897&action=edit Bug 27353: Add tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #114896|0 |1 is obsolete| | --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 115039 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115039&action=edit Bug 27353: Set X-Base-Total-Count header for REST API We already set X-Total-Count to the total number of filtered rows, but we don't have the total number of non-filtered rows. Test plan: This is easy to test on top of bug 27352 or bug 27251, apply them if not pushed yet. 1. Create 40 items with public notes = "xxx" for biblionumber=4 then, using Postman (or whatever you prefer): http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains Check the headers and confirm you see X-Total-Count=40 and X-Base-Total-Count=44 2. go to /cgi-bin/koha/tools/quotes.pl You see "Showing 1 to 20 of 28 entries" Search "he" Showing 1 to 20 of 22 entries (filtered from 28 total entries) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27402 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27402 [Bug 27402] Add column filtering to the Datatables REST API wrapper -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #115039|0 |1 is obsolete| | --- Comment #5 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 115058 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115058&action=edit Bug 27353: Set X-Base-Total-Count header for REST API We already set X-Total-Count to the total number of filtered rows, but we don't have the total number of non-filtered rows. Test plan: This is easy to test on top of bug 27352 or bug 27251, apply them if not pushed yet. 1. Create 40 items with public notes = "xxx" for biblionumber=4 then, using Postman (or whatever you prefer): http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains Check the headers and confirm you see X-Total-Count=40 and X-Base-Total-Count=44 2. go to /cgi-bin/koha/tools/quotes.pl You see "Showing 1 to 20 of 28 entries" Search "he" Showing 1 to 20 of 22 entries (filtered from 28 total entries) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #115058|0 |1 is obsolete| | --- Comment #6 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 115059 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115059&action=edit Bug 27353: Set X-Base-Total-Count header for REST API We already set X-Total-Count to the total number of filtered rows, but we don't have the total number of non-filtered rows. Test plan: This is easy to test on top of bug 27352 or bug 27251, apply them if not pushed yet. 1. Create 40 items with public notes = "xxx" for biblionumber=4 then, using Postman (or whatever you prefer): http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains Check the headers and confirm you see X-Total-Count=40 and X-Base-Total-Count=44 2. go to /cgi-bin/koha/tools/quotes.pl You see "Showing 1 to 20 of 28 entries" Search "he" Showing 1 to 20 of 22 entries (filtered from 28 total entries) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27467 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27467 [Bug 27467] Provide a static URL for tables -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com Version|unspecified |master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Comment on attachment 115059 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115059 Bug 27353: Set X-Base-Total-Count header for REST API
diff --git a/Koha/REST/V1/Checkouts.pm b/Koha/REST/V1/Checkouts.pm index 93feeaeb24..1dd68d264d 100644 --- a/Koha/REST/V1/Checkouts.pm +++ b/Koha/REST/V1/Checkouts.pm @@ -90,13 +90,13 @@ sub list {
# Perform search my $checkouts = $checkouts_set->search( $filtered_params, $attributes ); + my $total = $checkouts_rs->search->count;
$checkouts_set vs. $checkouts_rs.
diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm index 5eba4bdee3..ad67243cf1 100644 --- a/Koha/REST/V1/Patrons.pm +++ b/Koha/REST/V1/Patrons.pm @@ -82,14 +82,15 @@ sub list { if $restricted;
my $patrons = $patrons_rs->search( $filtered_params, $attributes ); - if ( $patrons_rs->is_paged ) { - $c->add_pagination_headers( - { - total => $patrons->pager->total_entries, - params => $args, - } - ); - }
This looks like an actual bug in the original code!
+ my $total = $orders_rs->search->count; + + $c->add_pagination_headers( + { + total => ($patrons->is_paged ? $patrons->pager->total_entries : $patrons->count), + base_total => $total, + params => $args, + } + );
$orders_rs looks like a copy and paste error. Overall: I like the implementation. Besides this minor glitches, I think we could have unit tests for the changes to Patrons.pm and Checkouts.pm. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #115059|0 |1 is obsolete| | --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 115769 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115769&action=edit Bug 27353: Set X-Base-Total-Count header for REST API We already set X-Total-Count to the total number of filtered rows, but we don't have the total number of non-filtered rows. Test plan: This is easy to test on top of bug 27352 or bug 27251, apply them if not pushed yet. 1. Create 40 items with public notes = "xxx" for biblionumber=4 then, using Postman (or whatever you prefer): http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains Check the headers and confirm you see X-Total-Count=40 and X-Base-Total-Count=44 2. go to /cgi-bin/koha/tools/quotes.pl You see "Showing 1 to 20 of 28 entries" Search "he" Showing 1 to 20 of 22 entries (filtered from 28 total entries) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I fixed the 2 copy/paste errors.
This looks like an actual bug in the original code!
What exactly? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |27544 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27544 [Bug 27544] Simplilfy /checkouts implementation -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #115769|0 |1 is obsolete| | --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 115771 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115771&action=edit Bug 27353: Set X-Base-Total-Count header for REST API We already set X-Total-Count to the total number of filtered rows, but we don't have the total number of non-filtered rows. Test plan: This is easy to test on top of bug 27352 or bug 27251, apply them if not pushed yet. 1. Create 40 items with public notes = "xxx" for biblionumber=4 then, using Postman (or whatever you prefer): http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains Check the headers and confirm you see X-Total-Count=40 and X-Base-Total-Count=44 2. go to /cgi-bin/koha/tools/quotes.pl You see "Showing 1 to 20 of 28 entries" Search "he" Showing 1 to 20 of 22 entries (filtered from 28 total entries) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff --- Comment #11 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Jonathan Druart from comment #9)
I fixed the 2 copy/paste errors.
This looks like an actual bug in the original code!
What exactly?
See bug 27544. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #114897|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #115771|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 --- Comment #12 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 115784 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115784&action=edit Bug 27353: Add tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 --- Comment #13 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 115785 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115785&action=edit Bug 27353: Set X-Base-Total-Count header for REST API We already set X-Total-Count to the total number of filtered rows, but we don't have the total number of non-filtered rows. Test plan: This is easy to test on top of bug 27352 or bug 27251, apply them if not pushed yet. 1. Create 40 items with public notes = "xxx" for biblionumber=4 then, using Postman (or whatever you prefer): http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains Check the headers and confirm you see X-Total-Count=40 and X-Base-Total-Count=44 2. go to /cgi-bin/koha/tools/quotes.pl You see "Showing 1 to 20 of 28 entries" Search "he" Showing 1 to 20 of 22 entries (filtered from 28 total entries) Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 --- Comment #14 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 115786 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115786&action=edit Bug 27353: (QA follow-up) Fix number of tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #115784|0 |1 is obsolete| | --- Comment #15 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 115807 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115807&action=edit Bug 27353: Add tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #115785|0 |1 is obsolete| | --- Comment #16 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 115808 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115808&action=edit Bug 27353: Set X-Base-Total-Count header for REST API We already set X-Total-Count to the total number of filtered rows, but we don't have the total number of non-filtered rows. Test plan: This is easy to test on top of bug 27352 or bug 27251, apply them if not pushed yet. 1. Create 40 items with public notes = "xxx" for biblionumber=4 then, using Postman (or whatever you prefer): http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains Check the headers and confirm you see X-Total-Count=40 and X-Base-Total-Count=44 2. go to /cgi-bin/koha/tools/quotes.pl You see "Showing 1 to 20 of 28 entries" Search "he" Showing 1 to 20 of 22 entries (filtered from 28 total entries) Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #115786|0 |1 is obsolete| | --- Comment #17 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 115809 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115809&action=edit Bug 27353: (QA follow-up) Fix number of tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #18 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice little enhancement, works as expected, no regressions found and passes QA scripts. Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |21.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 --- Comment #19 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 21.05, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #20 from Fridolin Somers <fridolin.somers@biblibre.com> --- What do you say about backporting to 20.11.x ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |caroline.cyr-la-rose@inlibr | |o.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Andrew Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |28880 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28880 [Bug 28880] Warning in tr (at Mojo/Headers.pm) because of undef X-Base-Total-Count HTTP header value -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353 Andrew Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nugged@gmail.com --- Comment #21 from Andrew Nugged <nugged@gmail.com> --- Bug 28800: X-Base-Total-Count undefined in "old-style-usage", should we add backward compatibility? -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org