Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
81e3afbc
Commit
81e3afbc
authored
Dec 02, 2018
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #714 (advanced search for ratings)
parent
7526b0dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
web.py
cps/web.py
+4
-2
No files found.
cps/web.py
View file @
81e3afbc
...
@@ -2056,9 +2056,11 @@ def advanced_search():
...
@@ -2056,9 +2056,11 @@ def advanced_search():
for
language
in
exclude_languages_inputs
:
for
language
in
exclude_languages_inputs
:
q
=
q
.
filter
(
not_
(
db
.
Books
.
series
.
any
(
db
.
Languages
.
id
==
language
)))
q
=
q
.
filter
(
not_
(
db
.
Books
.
series
.
any
(
db
.
Languages
.
id
==
language
)))
if
rating_high
:
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
:
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
:
if
description
:
q
=
q
.
filter
(
db
.
Books
.
comments
.
any
(
db
.
Comments
.
text
.
ilike
(
"
%
"
+
description
+
"
%
"
)))
q
=
q
.
filter
(
db
.
Books
.
comments
.
any
(
db
.
Comments
.
text
.
ilike
(
"
%
"
+
description
+
"
%
"
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment