Skip to content

Add sort by date added to Series list page#3630

Open
iBeech wants to merge 1 commit into
janeczku:masterfrom
iBeech:feature/recently-added-series
Open

Add sort by date added to Series list page#3630
iBeech wants to merge 1 commit into
janeczku:masterfrom
iBeech:feature/recently-added-series

Conversation

@iBeech
Copy link
Copy Markdown

@iBeech iBeech commented Apr 17, 2026

On a library with a few hundred series, the alphabetical-only Series page makes it hard to spot what's been added recently. My wife (an avid user who gets through new series faster than the default landing page surfaces them) asked whether there was a way to see the most recently added series first, so this PR adds that option.

A third sort button (calendar + sort-by-order icons) on /series sorts series descending by the latest book timestamp in each series, with Series.sort as a tiebreaker for determinism. The preference persists via the existing set_view_property mechanism like the asc/desc buttons.

While implementing this I hit a latent bug in filter_grid.js: the #asc and #desc handlers use sortBy: "name" with no corresponding key in getSortData, so isotope silently fell back to "original DOM order" for the sort. This worked by accident because the server renders the DOM in the correct order at init, and the asc/desc handlers toggled between original and reversed. But once the new button re-sorts the DOM client-side by timestamp, subsequent asc/desc clicks toggled between timestamp order and its reverse instead of A-Z / Z-A. The fix is small: add name: "[data-name]" to getSortData, and replace the !sortAscending toggle with explicit true/false. Asc/desc behaviour on non-series pages that share this JS (authors, categories, ratings, etc.) is observably unchanged. They were already producing correct results via the fallback, and the explicit values produce the same output.

Default behaviour is unchanged. The new button follows the same ajax pattern as the existing sort buttons, and other list routes are untouched.

calibre-web has been central to how we share books as a family, and we're glad to contribute back.

Suggested addition to test/test_list_orders.py::test_series_sort if you'd like coverage:

self.check_element_on_page((By.ID, "new")).click()
time.sleep(1)
list_element = self.get_list_books_displayed()
self.assertEqual(list_element[0]['title'], "<newest_series>")
self.driver.refresh()
list_element = self.get_list_books_displayed()
self.assertEqual(list_element[0]['title'], "<newest_series>")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant