Bug 24308 - Add ability to sort by dates in the suggestions table
Summary: Add ability to sort by dates in the suggestions table
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Lucas Gass (lukeg)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-26 16:50 UTC by Lucas Gass (lukeg)
Modified: 2020-11-30 21:45 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Separates information about dates and roles into separate columns so they can be sorted nicely.
Version(s) released in:
20.05.00, 19.11.02
Circulation function:


Attachments
Bug 24308: Suggestions table on suggestions.pl should have separate columns for dates (2.73 KB, patch)
2019-12-26 17:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 24308: Suggestions table on suggestions.pl should have separate columns for dates (2.78 KB, patch)
2020-01-02 14:04 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 24308: Suggestions table on suggestions.pl should have separate columns for dates (2.84 KB, patch)
2020-01-02 22:06 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2019-12-26 16:50:44 UTC
On the suggestions management page the table has a column called "Suggested by - on". Some librarians would like to be able to sort by both patron name and suggestion date and they currently cannot since it is a single column. This should be 2 columns.

The same is true for the "Managed by - on" column.
Comment 1 Lucas Gass (lukeg) 2019-12-26 17:14:29 UTC
Created attachment 96642 [details] [review]
Bug 24308: Suggestions table on suggestions.pl should have separate columns for dates

This patch sepearetes the "Suggested by - on" and "Managed by - on" columns into sepearte columns for the names and dates for better sortability. It adds a data-order class to the <td> so it will sort the dates correctly.$

TEST PLAN:
1. Have multiple suggestions with multiple dates. Make sure some are Pending, Accepted, Checked, Rejected, Available, and Ordered   
2. Notice the 'Suggested by - on' and 'Managed by - on' are a single column and you cannot sort by date.
3. Apply patch
4. The tables should now have seprate columns "Suggested on" and "Managed on" that are sortable by date. 
5. Make sure you can sort in the "Pending", "Accepted", and "Rejected" columns.
6. Sign off
Comment 2 Katrin Fischer 2019-12-29 14:12:55 UTC
Hi Lucas, this already looks nice, but I think we need a little magic for the dates to sort correctly in all date formats. At the moment it appears to only sort alphabetically.
Comment 3 Lucas Gass (lukeg) 2019-12-30 22:14:04 UTC
I think this sorts correctly with the attribute data-order, which is the unformatted date. ie (2019-11-11). I can't make it sort wrong.

Owen, any advice here?


Thanks
Comment 4 Katrin Fischer 2019-12-30 22:37:46 UTC
I think I must have missed the data-order attribute looking at it the first time (sorry!). Not sure if that's the standard way, but it makes sense at first glance.
Comment 5 Owen Leonard 2020-01-02 14:01:31 UTC
Just for reference, here is the method we've used most commonly:

https://wiki.koha-community.org/wiki/DataTables_HowTo#Sorting_dates_regardless_of_date_format_preference

We added the "title-string" sorting method when we were on DataTables 1.9.x. The use of HTML5 data attributes was introduced with DataTables v1.10.5, after the other method had become our standard.

There's no reason not to switch to this more up-to-date sorting configuration especially since it's built into DataTables instead of relying on an addition.
Comment 6 Owen Leonard 2020-01-02 14:04:43 UTC
Created attachment 96745 [details] [review]
Bug 24308: Suggestions table on suggestions.pl should have separate columns for dates

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 7 Katrin Fischer 2020-01-02 22:06:02 UTC
Created attachment 96774 [details] [review]
Bug 24308: Suggestions table on suggestions.pl should have separate columns for dates

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Martin Renvoize (ashimema) 2020-01-08 14:43:46 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 9 Joy Nelson 2020-01-12 19:11:10 UTC
Pushed to 19.11.x branch for 19.11.02
Comment 10 Lucas Gass (lukeg) 2020-01-13 23:25:46 UTC
backported to 19.05.x for 19.05.07
Comment 11 Hayley Pelham 2020-01-15 00:35:04 UTC
Enhancement will not be backported to 18.11.x series