openlibrary
openlibrary copied to clipboard
feat: added "sort by date finished" for Already Readed books
Closes #11336
Changes
Controller (mybooks.py):
- Accepts the new order_by parameter (either created or finished).
- Passes sort choice through to the reading log/business logic.
- Normalizes sort types for backend compatibility.
Database Layer (bookshelves.py):
- Expands sort logic to support finished asc/desc alongside created.
- Pads partial dates (year, year+month) for correct sorting.
- Books without a finish date are ordered last (when sorting descending) or first (when sorting ascending).
- SQL sorts by: padded finish date → specificity → date added, as outlined in the issue.
UI Template (reading_log.html):
- Adds four sort options (Date Added: newest/oldest, Date Finished: newest/oldest) for “Already Read” shelf.
- Highlights the currently active sort choice.
- Other shelves retain two sort options.
Screen Recoding
https://github.com/user-attachments/assets/ee42e394-7a76-4a12-8540-24b873f69a55
Stakeholders
@mekarpeles
@mekarpeles please let me know if there’s any issue.