From 1134f54be496e1388401aaa088b6351d86572b9f Mon Sep 17 00:00:00 2001 From: jarynclouatre Date: Sun, 1 Mar 2026 20:44:05 -0600 Subject: [PATCH] fix: series list view sorts by name instead of sort field In series_list(), the SQLite query correctly orders results by Series.sort, but a subsequent Python sorted() call (needed to re-order after appending the "None" category entry) was using Series.name as the sort key instead of Series.sort. This caused series titles with leading articles (A, An, The) to sort strictly alphabetically by the article rather than by the meaningful word, e.g. "A Collins-Burke Mystery" appeared under "A" instead of "C". Fix by using Series.sort (with a fallback to Series.name if sort is NULL) as the key in the Python re-sort, consistent with the intent of the existing DB query. Fixes #3583 --- cps/web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index 961e1df7..99fb362a 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1026,7 +1026,7 @@ def series_list(): .count()) if no_series_count: entries.append([db.Category(_("None"), "-1"), no_series_count]) - entries = sorted(entries, key=lambda x: x[0].name.lower(), reverse=not order_no) + entries = sorted(entries, key=lambda x: (x[0].sort or x[0].name).lower(), reverse=not order_no) return render_title_template('list.html', entries=entries, folder='web.books_list',