Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

kwang yang flask hw #1

wants to merge 1 commit into from

Conversation

kwangyy
Copy link

@kwangyy kwangyy commented Oct 11, 2022

No description provided.

def get_profile(id):
try:
data = {'name': db[id]['name'], 'scores': db[id]['scores']}
Copy link
Owner

@vinatsx vinatsx Oct 12, 2022

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]
Copy link
Owner

@vinatsx vinatsx Oct 12, 2022

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')
Copy link
Owner

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')

Copy link
Owner

@vinatsx vinatsx left a 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:
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants