Bug 19196 introduces a handy pagination handling plugin that would benefit from a syspref where a default page size can be specified.
Created attachment 66994 [details] [review] Bug 19278: Add RESTdefaultPageSize syspref
Created attachment 66995 [details] [review] Bug 19278: Unit tests This patch introduces tests for a behaviour change in Koha::REST::Plugin::Pagination. To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/Koha/REST/Plugin/Pagination.t => FAIL: Tests should fail without the followup patch applied Sponsored-by: Camden County Sponsored-by: Bywater Solutions
Created attachment 66996 [details] [review] Bug 19278: Make the pagination plugin use RESTdefaultPageSize This bug introduces a new syspref RESTdefaultPageSize that is used on the Koha::REST::Plugin::Pagination plugin to default to a valid value for the page size if the param is not present on the query. This patch also considers the situation in which no 'page' param is passed, and no header should be added. To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/Koha/REST/Plugin/Pagination.t => FAIL: Tests fail because the plugin doesn't behave as the tests expect. - Apply this patch - Run: k$ prove t/Koha/REST/Plugin/Pagination.t => SUCCESS: Tests pass! - Sign off :-D Sponsored-by: Camden County Sponsored-by: ByWater Solutions
Created attachment 67341 [details] [review] Bug 19278: Mention RESTdefaultPageSize in POD This patch adds information about RESTdefaultPageSize usage when the per_page parameter is absent on the query.
Hi Tomas Sorry but when applying your patch I got the following merge error, (note: I did apply patch 19196 beforehand): Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 19278: Add RESTdefaultPageSize syspref Applying: Bug 19278: Unit tests Using index info to reconstruct a base tree... M t/Koha/REST/Plugin/Pagination.t Falling back to patching base and 3-way merge... Auto-merging t/Koha/REST/Plugin/Pagination.t Applying: Bug 19278: Make the pagination plugin use RESTdefaultPageSize fatal: sha1 information is lacking or useless (Koha/REST/Plugin/Pagination.pm). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 Bug 19278: Make the pagination plugin use RESTdefaultPageSize The copy of the patch that failed is found in: /home/vagrant/kohaclone/.git/rebase-apply/patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-19278-Make-the-pagination-plugin-use-RESTdefau-NPNcVH.patch
Created attachment 67604 [details] [review] Bug 19278: Add RESTdefaultPageSize syspref
Created attachment 67605 [details] [review] Bug 19278: Unit tests This patch introduces tests for a behaviour change in Koha::REST::Plugin::Pagination. To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/Koha/REST/Plugin/Pagination.t => FAIL: Tests should fail without the followup patch applied Sponsored-by: Camden County Sponsored-by: Bywater Solutions
Created attachment 67606 [details] [review] Bug 19278: Make the pagination plugin use RESTdefaultPageSize This bug introduces a new syspref RESTdefaultPageSize that is used on the Koha::REST::Plugin::Pagination plugin to default to a valid value for the page size if the param is not present on the query. This patch also considers the situation in which no 'page' param is passed, and no header should be added. To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/Koha/REST/Plugin/Pagination.t => FAIL: Tests fail because the plugin doesn't behave as the tests expect. - Apply this patch - Run: k$ prove t/Koha/REST/Plugin/Pagination.t => SUCCESS: Tests pass! - Sign off :-D Sponsored-by: Camden County Sponsored-by: ByWater Solutions
Created attachment 67607 [details] [review] Bug 19278: Mention RESTdefaultPageSize in POD This patch adds information about RESTdefaultPageSize usage when the per_page parameter is absent on the query.
Hi Tomas Can you please rebase this patch against master because when I applied the patches attached to this bug report (after applying the dependencies) I got the following merge error: Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 19278: Add RESTdefaultPageSize syspref Applying: Bug 19278: Unit tests fatal: sha1 information is lacking or useless (t/Koha/REST/Plugin/Pagination.t). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 Bug 19278: Unit tests The copy of the patch that failed is found in: /home/vagrant/kohaclone/.git/rebase-apply/patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-19278-Unit-tests-3gVPjM.patch
I changes the dependencies because I fixed it on a working branch with other patches.
Hi Tomas It is still failing when applying the patches (specifically it is failing when applying the Unit Tests patch). I've applied the dependencies listed on the patch as of 5 minutes ago. Please let me know if I am missing something? Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 19278: Add RESTdefaultPageSize syspref Applying: Bug 19278: Unit tests fatal: sha1 information is lacking or useless (t/Koha/REST/Plugin/Pagination.t). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 Bug 19278: Unit tests The copy of the patch that failed is found in: /home/vagrant/kohaclone/.git/rebase-apply/patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-19278-Unit-tests-XOrn2r.patch
Created attachment 67700 [details] [review] Bug 19278: Add RESTdefaultPageSize syspref
Created attachment 67701 [details] [review] Bug 19278: Unit tests This patch introduces tests for a behaviour change in Koha::REST::Plugin::Pagination. To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/Koha/REST/Plugin/Pagination.t => FAIL: Tests should fail without the followup patch applied Sponsored-by: Camden County Sponsored-by: Bywater Solutions
Created attachment 67702 [details] [review] Bug 19278: Make the pagination plugin use RESTdefaultPageSize This bug introduces a new syspref RESTdefaultPageSize that is used on the Koha::REST::Plugin::Pagination plugin to default to a valid value for the page size if the param is not present on the query. This patch also considers the situation in which no 'page' param is passed, and no header should be added. To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/Koha/REST/Plugin/Pagination.t => FAIL: Tests fail because the plugin doesn't behave as the tests expect. - Apply this patch - Run: k$ prove t/Koha/REST/Plugin/Pagination.t => SUCCESS: Tests pass! - Sign off :-D Sponsored-by: Camden County Sponsored-by: ByWater Solutions
Created attachment 67703 [details] [review] Bug 19278: Mention RESTdefaultPageSize in POD This patch adds information about RESTdefaultPageSize usage when the per_page parameter is absent on the query.
Alex, I'm not sure what's going on :-D My guess is that my Git version might be newer and smarter than yours (the merging algorithm). I've re-submitted just in case the commits are differently built. $ git --version git version 2.14.2 This are the deps: https://bugs.koha-community.org/bugzilla3/showdependencygraph.cgi?id=19278 Thanks!
Created attachment 67790 [details] [review] Bug 19278: Add RESTdefaultPageSize syspref Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Created attachment 67791 [details] [review] Bug 19278: Unit tests This patch introduces tests for a behaviour change in Koha::REST::Plugin::Pagination. To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/Koha/REST/Plugin/Pagination.t => FAIL: Tests should fail without the followup patch applied Sponsored-by: Camden County Sponsored-by: Bywater Solutions Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Created attachment 67792 [details] [review] Bug 19278: Make the pagination plugin use RESTdefaultPageSize This bug introduces a new syspref RESTdefaultPageSize that is used on the Koha::REST::Plugin::Pagination plugin to default to a valid value for the page size if the param is not present on the query. This patch also considers the situation in which no 'page' param is passed, and no header should be added. To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/Koha/REST/Plugin/Pagination.t => FAIL: Tests fail because the plugin doesn't behave as the tests expect. - Apply this patch - Run: k$ prove t/Koha/REST/Plugin/Pagination.t => SUCCESS: Tests pass! - Sign off :-D Sponsored-by: Camden County Sponsored-by: ByWater Solutions Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Created attachment 67793 [details] [review] Bug 19278: Mention RESTdefaultPageSize in POD This patch adds information about RESTdefaultPageSize usage when the per_page parameter is absent on the query. Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Created attachment 69365 [details] [review] Bug 19278: Add RESTdefaultPageSize syspref Signed-off-by: Lari Taskula <lari.taskula@jns.fi> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 69366 [details] [review] Bug 19278: Unit tests This patch introduces tests for a behaviour change in Koha::REST::Plugin::Pagination. To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/Koha/REST/Plugin/Pagination.t => FAIL: Tests should fail without the followup patch applied Sponsored-by: Camden County Sponsored-by: Bywater Solutions Signed-off-by: Lari Taskula <lari.taskula@jns.fi> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 69367 [details] [review] Bug 19278: Make the pagination plugin use RESTdefaultPageSize This bug introduces a new syspref RESTdefaultPageSize that is used on the Koha::REST::Plugin::Pagination plugin to default to a valid value for the page size if the param is not present on the query. This patch also considers the situation in which no 'page' param is passed, and no header should be added. To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/Koha/REST/Plugin/Pagination.t => FAIL: Tests fail because the plugin doesn't behave as the tests expect. - Apply this patch - Run: k$ prove t/Koha/REST/Plugin/Pagination.t => SUCCESS: Tests pass! - Sign off :-D Sponsored-by: Camden County Sponsored-by: ByWater Solutions Signed-off-by: Lari Taskula <lari.taskula@jns.fi> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 69368 [details] [review] Bug 19278: Mention RESTdefaultPageSize in POD This patch adds information about RESTdefaultPageSize usage when the per_page parameter is absent on the query. Signed-off-by: Lari Taskula <lari.taskula@jns.fi> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 69704 [details] [review] Bug 19278: (follow-up) Make the pagination plugin use RESTdefaultPageSize Use 20 as default for RESTdefaultPageSize (just in case) Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to master for 18.05, thanks to everybody involved!
Awesome work all! Enhancement, won't be backported for 17.11