mirror of
https://github.com/JonathanHerrewijnen/calibre-web.git
synced 2024-11-11 05:33:57 +00:00
Fixed missing joins for sorting according to series in read/unread and rated views
This commit is contained in:
parent
a63baa1758
commit
a32b36bf81
@ -692,6 +692,10 @@ class CalibreDB():
|
|||||||
query = self.session.query(database)
|
query = self.session.query(database)
|
||||||
if len(join) == 6:
|
if len(join) == 6:
|
||||||
query = query.outerjoin(join[0], join[1]).outerjoin(join[2]).outerjoin(join[3], join[4]).outerjoin(join[5])
|
query = query.outerjoin(join[0], join[1]).outerjoin(join[2]).outerjoin(join[3], join[4]).outerjoin(join[5])
|
||||||
|
if len(join) == 5:
|
||||||
|
query = query.outerjoin(join[0], join[1]).outerjoin(join[2]).outerjoin(join[3], join[4])
|
||||||
|
if len(join) == 4:
|
||||||
|
query = query.outerjoin(join[0], join[1]).outerjoin(join[2]).outerjoin(join[3])
|
||||||
if len(join) == 3:
|
if len(join) == 3:
|
||||||
query = query.outerjoin(join[0], join[1]).outerjoin(join[2])
|
query = query.outerjoin(join[0], join[1]).outerjoin(join[2])
|
||||||
elif len(join) == 2:
|
elif len(join) == 2:
|
||||||
|
14
cps/web.py
14
cps/web.py
@ -423,7 +423,11 @@ def render_rated_books(page, book_id, order):
|
|||||||
entries, random, pagination = calibre_db.fill_indexpage(page, 0,
|
entries, random, pagination = calibre_db.fill_indexpage(page, 0,
|
||||||
db.Books,
|
db.Books,
|
||||||
db.Books.ratings.any(db.Ratings.rating > 9),
|
db.Books.ratings.any(db.Ratings.rating > 9),
|
||||||
order)
|
order,
|
||||||
|
db.books_series_link,
|
||||||
|
db.Books.id == db.books_series_link.c.book,
|
||||||
|
db.Series)
|
||||||
|
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
id=book_id, title=_(u"Top Rated Books"), page="rated")
|
id=book_id, title=_(u"Top Rated Books"), page="rated")
|
||||||
else:
|
else:
|
||||||
@ -629,6 +633,9 @@ def render_read_books(page, are_read, as_xml=False, order=None):
|
|||||||
db.Books,
|
db.Books,
|
||||||
db_filter,
|
db_filter,
|
||||||
order,
|
order,
|
||||||
|
db.books_series_link,
|
||||||
|
db.Books.id == db.books_series_link.c.book,
|
||||||
|
db.Series,
|
||||||
ub.ReadBook, db.Books.id == ub.ReadBook.book_id)
|
ub.ReadBook, db.Books.id == ub.ReadBook.book_id)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
@ -640,6 +647,9 @@ def render_read_books(page, are_read, as_xml=False, order=None):
|
|||||||
db.Books,
|
db.Books,
|
||||||
db_filter,
|
db_filter,
|
||||||
order,
|
order,
|
||||||
|
db.books_series_link,
|
||||||
|
db.Books.id == db.books_series_link.c.book,
|
||||||
|
db.Series,
|
||||||
db.cc_classes[config.config_read_column])
|
db.cc_classes[config.config_read_column])
|
||||||
except (KeyError, AttributeError):
|
except (KeyError, AttributeError):
|
||||||
log.error("Custom Column No.%d is not existing in calibre database", config.config_read_column)
|
log.error("Custom Column No.%d is not existing in calibre database", config.config_read_column)
|
||||||
@ -787,7 +797,7 @@ def list_books():
|
|||||||
db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series
|
db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series
|
||||||
elif sort == "languages":
|
elif sort == "languages":
|
||||||
order = [db.Languages.lang_code.asc()] if order == "asc" else [db.Languages.lang_code.desc()]
|
order = [db.Languages.lang_code.asc()] if order == "asc" else [db.Languages.lang_code.desc()]
|
||||||
join = db.books_languages_link,db.Books.id == db.books_languages_link.c.book, db.Languages
|
join = db.books_languages_link, db.Books.id == db.books_languages_link.c.book, db.Languages
|
||||||
elif order and sort in ["sort", "title", "authors_sort", "series_index"]:
|
elif order and sort in ["sort", "title", "authors_sort", "series_index"]:
|
||||||
order = [text(sort + " " + order)]
|
order = [text(sort + " " + order)]
|
||||||
elif not state:
|
elif not state:
|
||||||
|
Loading…
Reference in New Issue
Block a user