Bug 31331 - OPAC suggestions table doesn't sort correctly by suggestiondate in some dateformats
Summary: OPAC suggestions table doesn't sort correctly by suggestiondate in some datef...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Lucas Gass
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-09 14:27 UTC by Lucas Gass
Modified: 2023-12-28 20:43 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00


Attachments
Bug 31331: Add data-order attribute for better sorting of dates (1.90 KB, patch)
2022-08-09 14:33 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31331: Add data-order attribute for better sorting of dates (1.95 KB, patch)
2022-08-09 15:28 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 31331: Add data-order attribute for better sorting of dates (2.02 KB, patch)
2022-08-12 13:31 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass 2022-08-09 14:27:05 UTC
To recreate:

1. I used the following suggestiondates:

MariaDB [koha_kohadev]> select suggesteddate from suggestions;
+---------------+
| suggesteddate |
+---------------+
| 2022-01-03    |
| 2022-08-09    |
| 2022-02-22    |
| 2021-01-21    |
+---------------+


2. Set the dateformat system preference to 'mm/dd/yyyy'. 
3. Try sorting the suggestion table bu date, ascending and descending, it is not right.
Comment 1 Lucas Gass 2022-08-09 14:30:02 UTC
I think the best solution/easiest solution is to use the data-order attribute on the suggesteddate column.
Comment 2 Lucas Gass 2022-08-09 14:33:51 UTC
Created attachment 138919 [details] [review]
Bug 31331: Add data-order attribute for better sorting of dates

To test:
1. I used the following suggestiondates:

MariaDB [koha_kohadev]> select suggesteddate from suggestions;
+---------------+
| suggesteddate |
+---------------+
| 2022-01-03    |
| 2022-08-09    |
| 2022-02-22    |
| 2021-01-21    |
+---------------+

2. Set the dateformat system preference to 'mm/dd/yyyy'.
3. Try sorting the suggestion table by date, ascending and descending, it is not right.
4. Apply patch
5. Try sorting by date again, ascending and descending, it should now sort correctly.
Comment 3 Owen Leonard 2022-08-09 15:28:36 UTC Comment hidden (obsolete)
Comment 4 Martin Renvoize 2022-08-12 13:31:24 UTC
Created attachment 139051 [details] [review]
Bug 31331: Add data-order attribute for better sorting of dates

To test:
1. I used the following suggestiondates:

MariaDB [koha_kohadev]> select suggesteddate from suggestions;
+---------------+
| suggesteddate |
+---------------+
| 2022-01-03    |
| 2022-08-09    |
| 2022-02-22    |
| 2021-01-21    |
+---------------+

2. Set the dateformat system preference to 'mm/dd/yyyy'.
3. Try sorting the suggestion table by date, ascending and descending,
   it is not right.
4. Apply patch
5. Try sorting by date again, ascending and descending, it should now
   sort correctly.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2022-08-12 13:32:03 UTC
Works as described, Passing QA.

Note: I was surprised to see this is a straight-up datatable and not a KohaTable yet.
Comment 6 Tomás Cohen Arazi 2022-08-16 12:21:04 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!