From f9b45058430312f1a4d8ac88eb9a2b5c1c3cabdb Mon Sep 17 00:00:00 2001 From: celogeek <65178+celogeek@users.noreply.github.com> Date: Sun, 19 Apr 2020 13:00:32 +0200 Subject: [PATCH] Sort search result by Books sort It is far easier to search for a series or anything and see books in sort order --- cps/helper.py | 2 +- cps/web.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cps/helper.py b/cps/helper.py index 5e5bde29..5b8bb567 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -802,7 +802,7 @@ def get_search_results(term): db.Books.authors.any(and_(*q)), db.Books.publishers.any(func.lower(db.Publishers.name).ilike("%" + term + "%")), func.lower(db.Books.title).ilike("%" + term + "%") - )).all() + )).order_by(db.Books.sort).all() def get_cc_columns(): tmpcc = db.session.query(db.Custom_Columns).filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all() diff --git a/cps/web.py b/cps/web.py index bfb0ec5d..23b37450 100644 --- a/cps/web.py +++ b/cps/web.py @@ -901,7 +901,7 @@ def advanced_search(): # Build custom columns names cc = get_cc_columns() db.session.connection().connection.connection.create_function("lower", 1, lcase) - q = db.session.query(db.Books).filter(common_filters()) + q = db.session.query(db.Books).filter(common_filters()).order_by(db.Books.sort) include_tag_inputs = request.args.getlist('include_tag') exclude_tag_inputs = request.args.getlist('exclude_tag')