Bug 23427

Summary: Better sorting of previous checkouts
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: CirculationAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: black23, gmcharlt, kyle.m.hall, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00
Bug Depends on: 13908    
Bug Blocks: 24456    
Attachments: Bug 23427: fix previous checkouts sort order
Bug 23427: Better sorting of previous checkouts
Bug 23427: fix previous checkouts sort order
Bug 23427: Better sorting of previous checkouts
Bug 23427: fix previous checkouts sort order
Bug 23427: Better sorting of previous checkouts
Bug 23427: Simplify sort logic

Description Fridolin Somers 2019-08-05 13:03:24 UTC
In patron circulation or details page, previous checkouts are displayed sorted by due date.
Actual sort order is not honoring system preference "previousIssuesDefaultSortOrder". Todays's checkouts is correct thanks to Bug 13908.
Many checkouts may have same due date so it would be better to sort on timestamp as second sort criteria, like todays's checkouts.
Comment 1 Fridolin Somers 2019-08-05 13:32:48 UTC
Created attachment 91993 [details] [review]
Bug 23427: fix previous checkouts sort order

In patron circulation or details page, previous checkouts are displayed sorted by due date.
Actual sort order is not honoring system preference "previousIssuesDefaultSortOrder". Todays's checkouts is correct thanks to Bug 13908.

Patch adds comments that refer to the text of system preferences "previousIssuesDefaultSortOrder" and "TodayIssuesDefaultSortOrder" :
  latest to earliest = asc
  earliest to latest = desc

Test plan :
1) Create for a patron two old issues with a few days between them
2) Set preference previousIssuesDefaultSortOrder = "latest to earliest"
3) Go to patron circulation page and check sort order is OK
4) Go to patron details page and check sort order is OK
5) Set preference previousIssuesDefaultSortOrder = "earliest to latest"
6) Go to patron circulation page and check sort order is OK
7) Go to patron details page and check sort order is OK
Comment 2 Fridolin Somers 2019-08-05 13:33:02 UTC
Created attachment 91994 [details] [review]
Bug 23427: Better sorting of previous checkouts

In patron circulation or details page, previous checkouts are displayed sorted by due date.
Many checkouts may have same due date so it would be better to sort on timestamp as second sort criteria, like todays's checkouts.

Test plan :
1) Create for a patron two issues with same due date and a few seconds between them
2) Create another issue with a different due date
3) Come back a day later
4) Set preference previousIssuesDefaultSortOrder = "latest to earliest"
5) Go to patron circulation page and check sort order is OK : sorted by "Due date" then "Cheked out on"
6) Go to patron details page and check sort order is OK : sorted by "Due date" then "Cheked out on"
7) Set preference previousIssuesDefaultSortOrder = "earliest to latest"
8) Go to patron circulation page and check sort order is OK : sorted by "Due date" then "Cheked out on"
9) Go to patron details page and check sort order is OK : sorted by "Due date" then "Cheked out on"
Comment 3 Michal Denar 2019-10-16 08:21:13 UTC
Created attachment 94259 [details] [review]
Bug 23427: fix previous checkouts sort order

In patron circulation or details page, previous checkouts are displayed sorted by due date.
Actual sort order is not honoring system preference "previousIssuesDefaultSortOrder". Todays's checkouts is correct thanks to Bug 13908.

Patch adds comments that refer to the text of system preferences "previousIssuesDefaultSortOrder" and "TodayIssuesDefaultSortOrder" :
  latest to earliest = asc
  earliest to latest = desc

Test plan :
1) Create for a patron two old issues with a few days between them
2) Set preference previousIssuesDefaultSortOrder = "latest to earliest"
3) Go to patron circulation page and check sort order is OK
4) Go to patron details page and check sort order is OK
5) Set preference previousIssuesDefaultSortOrder = "earliest to latest"
6) Go to patron circulation page and check sort order is OK
7) Go to patron details page and check sort order is OK

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 4 Michal Denar 2019-10-16 08:21:17 UTC
Created attachment 94260 [details] [review]
Bug 23427: Better sorting of previous checkouts

In patron circulation or details page, previous checkouts are displayed sorted by due date.
Many checkouts may have same due date so it would be better to sort on timestamp as second sort criteria, like todays's checkouts.

Test plan :
1) Create for a patron two issues with same due date and a few seconds between them
2) Create another issue with a different due date
3) Come back a day later
4) Set preference previousIssuesDefaultSortOrder = "latest to earliest"
5) Go to patron circulation page and check sort order is OK : sorted by "Due date" then "Cheked out on"
6) Go to patron details page and check sort order is OK : sorted by "Due date" then "Cheked out on"
7) Set preference previousIssuesDefaultSortOrder = "earliest to latest"
8) Go to patron circulation page and check sort order is OK : sorted by "Due date" then "Cheked out on"
9) Go to patron details page and check sort order is OK : sorted by "Due date" then "Cheked out on"

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 5 Jonathan Druart 2019-11-07 12:37:03 UTC
Created attachment 95149 [details] [review]
Bug 23427: fix previous checkouts sort order

In patron circulation or details page, previous checkouts are displayed sorted by due date.
Actual sort order is not honoring system preference "previousIssuesDefaultSortOrder". Todays's checkouts is correct thanks to Bug 13908.

Patch adds comments that refer to the text of system preferences "previousIssuesDefaultSortOrder" and "TodayIssuesDefaultSortOrder" :
  latest to earliest = asc
  earliest to latest = desc

Test plan :
1) Create for a patron two old issues with a few days between them
2) Set preference previousIssuesDefaultSortOrder = "latest to earliest"
3) Go to patron circulation page and check sort order is OK
4) Go to patron details page and check sort order is OK
5) Set preference previousIssuesDefaultSortOrder = "earliest to latest"
6) Go to patron circulation page and check sort order is OK
7) Go to patron details page and check sort order is OK

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2019-11-07 12:37:08 UTC
Created attachment 95150 [details] [review]
Bug 23427: Better sorting of previous checkouts

In patron circulation or details page, previous checkouts are displayed sorted by due date.
Many checkouts may have same due date so it would be better to sort on timestamp as second sort criteria, like todays's checkouts.

Test plan :
1) Create for a patron two issues with same due date and a few seconds between them
2) Create another issue with a different due date
3) Come back a day later
4) Set preference previousIssuesDefaultSortOrder = "latest to earliest"
5) Go to patron circulation page and check sort order is OK : sorted by "Due date" then "Cheked out on"
6) Go to patron details page and check sort order is OK : sorted by "Due date" then "Cheked out on"
7) Set preference previousIssuesDefaultSortOrder = "earliest to latest"
8) Go to patron circulation page and check sort order is OK : sorted by "Due date" then "Cheked out on"
9) Go to patron details page and check sort order is OK : sorted by "Due date" then "Cheked out on"

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2019-11-07 12:37:13 UTC
Created attachment 95151 [details] [review]
Bug 23427: Simplify sort logic

This is the usual syntax.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Martin Renvoize 2019-11-07 13:25:49 UTC
Nice bit of golfing there, thanks :)
Comment 9 Martin Renvoize 2019-11-07 13:27:17 UTC
Nice work!

Pushed to master for 19.11.00
Comment 10 Lucas Gass 2019-12-16 22:08:41 UTC
backported to 19.05.x for 19.05.06