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
f80c6782
Commit
f80c6782
authored
Jul 05, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1500 (Custom ratings of increment 0.5 are allowed)
parent
d1889a5e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
5 deletions
+5
-5
book_edit.html
cps/templates/book_edit.html
+2
-2
detail.html
cps/templates/detail.html
+1
-1
search_form.html
cps/templates/search_form.html
+1
-1
web.py
cps/web.py
+1
-1
No files found.
cps/templates/book_edit.html
View file @
f80c6782
...
@@ -159,9 +159,9 @@
...
@@ -159,9 +159,9 @@
{% endif %}
{% endif %}
{% if c.datatype == 'rating' %}
{% if c.datatype == 'rating' %}
<input
type=
"number"
min=
"1"
max=
"5"
step=
"
1
"
class=
"form-control"
name=
"{{ 'custom_column_' ~ c.id }}"
id=
"{{ 'custom_column_' ~ c.id }}"
<input
type=
"number"
min=
"1"
max=
"5"
step=
"
0.5
"
class=
"form-control"
name=
"{{ 'custom_column_' ~ c.id }}"
id=
"{{ 'custom_column_' ~ c.id }}"
{%
if
book
['
custom_column_
'
~
c
.
id
]|
length
>
0 %}
{%
if
book
['
custom_column_
'
~
c
.
id
]|
length
>
0 %}
value="{{ '%
d
' % (book['custom_column_' ~ c.id][0].value / 2) }}"
value="{{ '%
.1f
' % (book['custom_column_' ~ c.id][0].value / 2) }}"
{% endif %}>
{% endif %}>
{% endif %}
{% endif %}
</div>
</div>
...
...
cps/templates/detail.html
View file @
f80c6782
...
@@ -174,7 +174,7 @@
...
@@ -174,7 +174,7 @@
{{ c.name }}:
{{ c.name }}:
{% for column in entry['custom_column_' ~ c.id] %}
{% for column in entry['custom_column_' ~ c.id] %}
{% if c.datatype == 'rating' %}
{% if c.datatype == 'rating' %}
{{ '%d' % (column.value / 2) }}
{{ '%d' % (column.value / 2) }}
{% if ((column.value /2) % 1) != 0 %}{{ '.%d' % (((column.value /2) % 1)*10) }} {% endif %}
{% else %}
{% else %}
{% if c.datatype == 'bool' %}
{% if c.datatype == 'bool' %}
{% if column.value == true %}
{% if column.value == true %}
...
...
cps/templates/search_form.html
View file @
f80c6782
...
@@ -165,7 +165,7 @@
...
@@ -165,7 +165,7 @@
{% endif %}
{% endif %}
{% if c.datatype == 'rating' %}
{% if c.datatype == 'rating' %}
<input
type=
"number"
min=
"1"
max=
"5"
step=
"
1
"
class=
"form-control"
name=
"{{ 'custom_column_' ~ c.id }}"
id=
"{{ 'custom_column_' ~ c.id }}"
>
<input
type=
"number"
min=
"1"
max=
"5"
step=
"
0.5
"
class=
"form-control"
name=
"{{ 'custom_column_' ~ c.id }}"
id=
"{{ 'custom_column_' ~ c.id }}"
>
{% endif %}
{% endif %}
</div>
</div>
{% endfor %}
{% endfor %}
...
...
cps/web.py
View file @
f80c6782
...
@@ -1142,7 +1142,7 @@ def advanced_search():
...
@@ -1142,7 +1142,7 @@ def advanced_search():
db
.
cc_classes
[
c
.
id
]
.
value
==
custom_query
))
db
.
cc_classes
[
c
.
id
]
.
value
==
custom_query
))
elif
c
.
datatype
==
'rating'
:
elif
c
.
datatype
==
'rating'
:
q
=
q
.
filter
(
getattr
(
db
.
Books
,
'custom_column_'
+
str
(
c
.
id
))
.
any
(
q
=
q
.
filter
(
getattr
(
db
.
Books
,
'custom_column_'
+
str
(
c
.
id
))
.
any
(
db
.
cc_classes
[
c
.
id
]
.
value
==
int
(
custom_query
)
*
2
))
db
.
cc_classes
[
c
.
id
]
.
value
==
int
(
float
(
custom_query
)
*
2
)
))
else
:
else
:
q
=
q
.
filter
(
getattr
(
db
.
Books
,
'custom_column_'
+
str
(
c
.
id
))
.
any
(
q
=
q
.
filter
(
getattr
(
db
.
Books
,
'custom_column_'
+
str
(
c
.
id
))
.
any
(
func
.
lower
(
db
.
cc_classes
[
c
.
id
]
.
value
)
.
ilike
(
"
%
"
+
custom_query
+
"
%
"
)))
func
.
lower
(
db
.
cc_classes
[
c
.
id
]
.
value
)
.
ilike
(
"
%
"
+
custom_query
+
"
%
"
)))
...
...
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