Next try showing last book of series in grid view

This commit is contained in:
Ozzie Isaacs 2023-08-27 12:00:15 +02:00
parent 8535bb5821
commit 6a14e2cf68
2 changed files with 15 additions and 7 deletions

View File

@ -28,7 +28,7 @@
<div class="cover"> <div class="cover">
<a href="{{url_for('web.books_list', data=data, sort_param='stored', book_id=entry[0].series[0].id )}}"> <a href="{{url_for('web.books_list', data=data, sort_param='stored', book_id=entry[0].series[0].id )}}">
<span class="img" title="{{entry[0].series[0].name}}"> <span class="img" title="{{entry[0].series[0].name}}">
{{ image.series(entry[0].series[0], alt=entry[0].series[0].name|shortentitle) }} {{ image.book_cover(entry[0])}}
<span class="badge">{{entry.count}}</span> <span class="badge">{{entry.count}}</span>
</span> </span>
</a> </a>

View File

@ -1002,13 +1002,21 @@ def series_list():
if no_series_count: if no_series_count:
entries.append([db.Category(_("None"), "-1"), 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].name.lower(), reverse=not order_no)
return render_title_template('list.html', entries=entries, folder='web.books_list', charlist=char_list, return render_title_template('list.html',
title=_("Series"), page="serieslist", data="series", order=order_no) entries=entries,
folder='web.books_list',
charlist=char_list,
title=_("Series"),
page="serieslist",
data="series", order=order_no)
else: else:
entries = calibre_db.session.query(db.Books, func.count('books_series_link').label('count'), entries = (calibre_db.session.query(db.Books, func.count('books_series_link').label('count'),
func.max(db.Books.series_index), db.Books.id) \ func.max(db.Books.series_index), db.Books.id)
.join(db.books_series_link).join(db.Series).filter(calibre_db.common_filters()) \ .join(db.books_series_link).join(db.Series).filter(calibre_db.common_filters())
.group_by(text('books_series_link.series')).order_by(order).all() .group_by(text('books_series_link.series'))
.having(func.max(db.Books.series_index))
.order_by(order)
.all())
return render_title_template('grid.html', entries=entries, folder='web.books_list', charlist=char_list, return render_title_template('grid.html', entries=entries, folder='web.books_list', charlist=char_list,
title=_("Series"), page="serieslist", data="series", bodyClass="grid-view", title=_("Series"), page="serieslist", data="series", bodyClass="grid-view",
order=order_no) order=order_no)