From 81e3afbcc4063b3d870a7bfbf961931edd3d2f80 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sun, 2 Dec 2018 12:48:12 +0100 Subject: [PATCH] Fix #714 (advanced search for ratings) --- cps/web.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cps/web.py b/cps/web.py index d5633e01..e5e4b9d6 100644 --- a/cps/web.py +++ b/cps/web.py @@ -2056,9 +2056,11 @@ def advanced_search(): for language in exclude_languages_inputs: q = q.filter(not_(db.Books.series.any(db.Languages.id == language))) if rating_high: - q = q.filter(db.Books.ratings.any(db.Ratings.id <= rating_high)) + rating_high = int(rating_high) * 2 + q = q.filter(db.Books.ratings.any(db.Ratings.rating <= rating_high)) if rating_low: - q = q.filter(db.Books.ratings.any(db.Ratings.id >= rating_low)) + rating_low = int(rating_low) *2 + q = q.filter(db.Books.ratings.any(db.Ratings.rating >= rating_low)) if description: q = q.filter(db.Books.comments.any(db.Comments.text.ilike("%" + description + "%")))