-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kwang yang flask hw #1
base: main
Are you sure you want to change the base?
Conversation
def get_profile(id): | ||
try: | ||
data = {'name': db[id]['name'], 'scores': db[id]['scores']} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider just db[id]
since the next question for POST is: POST /profiles to create a new profile (name only)
id = int(id) | ||
deleted = db[id] | ||
new_db = [profile for profile in db if profile != deleted] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider del db[id]
since doing this does not "delete" them from db variable.
e.g. DELETE request to delete id 0. output tells me that id 0 has been removed and the new_db does not have id 0. then I proceed to DELETE request to delete id 1. output tells me that id 1 has been removed but the new_db still have that id 0 person who is not supposed to be there anymore.
try: | ||
username = request.args.get('username') | ||
password_hash = request.args.get('passwordHash') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 18 is password but this line is passwordHash. after registering the user (with username and password), when i do a login, the user doesnt have a passwordHash. consider changing line 18 to get('passwordHash')
, or this line to get('password')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall gd attempt, look through the comments.
try: | ||
minScore = request.args.get('minScore') | ||
if minScore is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider also: if minScore == ''
for if minScore is None:
the request in POSTMAN is something like this profiles/0/score
for if minScore == ''
the request in POSTMAN is something like profiles/0/score?=minScore
No description provided.