From 58379159fb6cd711f5454578fb6ee8a9004534f3 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Thu, 4 Nov 2021 17:32:31 +0400 Subject: [PATCH] Fix shown cover in series grid view (#979) --- cps/templates/grid.html | 2 +- cps/web.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cps/templates/grid.html b/cps/templates/grid.html index 13a59b4a..b9d40961 100644 --- a/cps/templates/grid.html +++ b/cps/templates/grid.html @@ -27,7 +27,7 @@
- {{ entry[0].name }} + {{ entry[0].series[0].name }} {{entry.count}} diff --git a/cps/web.py b/cps/web.py index 8d3e4551..1089cdb0 100644 --- a/cps/web.py +++ b/cps/web.py @@ -931,8 +931,9 @@ def series_list(): return render_title_template('list.html', entries=entries, folder='web.books_list', charlist=charlist, title=_(u"Series"), page="serieslist", data="series", order=order_no) else: - entries = calibre_db.session.query(db.Books, func.count('books_series_link').label('count')) \ - .join(db.books_series_link).join(db.Series).filter(calibre_db.common_filters()) \ + entries = calibre_db.session.query(db.Books, func.count('books_series_link').label('count'), + func.max(db.Books.series_index), db.Books.id) \ + .join(db.books_series_link).join(db.Series).filter(calibre_db.common_filters())\ .group_by(text('books_series_link.series')).order_by(order).all() charlist = calibre_db.session.query(func.upper(func.substr(db.Series.sort, 1, 1)).label('char')) \ .join(db.books_series_link).join(db.Books).filter(calibre_db.common_filters()) \