Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS123-Canteeneo
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Willard Torres
CS123-Canteeneo
Commits
fc7bae33
Commit
fc7bae33
authored
Dec 03, 2016
by
Willard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ratings being coerced into integers
parent
3b19bd6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
api.py
canteeneo/api.py
+3
-3
models.py
canteeneo/models.py
+2
-2
No files found.
canteeneo/api.py
View file @
fc7bae33
...
...
@@ -125,7 +125,7 @@ def create_dish_review(dish_id):
user_id
=
g
.
user
.
id
title
=
request
.
json
[
'title'
]
body
=
request
.
json
[
'body'
]
rating
=
in
t
(
request
.
json
[
'rating'
])
rating
=
floa
t
(
request
.
json
[
'rating'
])
review
=
DishReview
(
title
,
body
,
rating
,
user_id
,
dish_id
)
db
.
session
.
add
(
review
)
db
.
session
.
commit
()
...
...
@@ -139,7 +139,7 @@ def edit_dish_review(dish_id, dish_review_id):
return
abort
(
401
)
review
.
title
=
request
.
json
[
'title'
]
review
.
body
=
request
.
json
[
'body'
]
review
.
rating
=
in
t
(
request
.
json
[
'rating'
])
review
.
rating
=
floa
t
(
request
.
json
[
'rating'
])
db
.
session
.
commit
()
return
jsonify
(
review_obj
(
review
))
...
...
@@ -204,7 +204,7 @@ def create_stall_review(stall_id):
user_id
=
g
.
user
.
id
title
=
request
.
form
[
'title'
]
body
=
request
.
form
[
'body'
]
rating
=
in
t
(
request
.
form
[
'rating'
])
rating
=
floa
t
(
request
.
form
[
'rating'
])
review
=
StallReview
(
title
,
body
,
rating
,
user_id
,
stall_id
)
db
.
session
.
add
(
review
)
db
.
session
.
commit
()
...
...
canteeneo/models.py
View file @
fc7bae33
...
...
@@ -146,7 +146,7 @@ class DishReview(db.Model):
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
title
=
db
.
Column
(
db
.
String
(
80
))
body
=
db
.
Column
(
db
.
Text
)
rating
=
db
.
Column
(
db
.
Integer
)
rating
=
db
.
Column
(
db
.
Float
)
user_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'user.id'
))
dish_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'dish.id'
))
...
...
@@ -161,7 +161,7 @@ class StallReview(db.Model):
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
title
=
db
.
Column
(
db
.
String
(
80
))
body
=
db
.
Column
(
db
.
Text
)
rating
=
db
.
Column
(
db
.
Integer
)
rating
=
db
.
Column
(
db
.
Float
)
user_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'user.id'
))
stall_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'stall.id'
))
...
...
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