Skip to content

Conversation

@kmanuponce
Copy link

Updating all endpoints to pass all test Waves

Copy link

@kaidamasaki kaidamasaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

I like that you split your routes file into goal_routes.py and task_routes.py. 😄

There were a few small things but overall everything looked great! Well done!

def handle_goal(goal_id):
goal = Goal.query.get(goal_id)

if goal == None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember, None is falsey:

Suggested change
if goal == None:
if not goal:

if goal == None:
return "",404

# goal.completed_at = None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a minor thing but it's an industry best practice to remove commented in code before you submit a PR so is a good habit to get into. 😄

return {
"id": goal.goal_id,
"title": goal.title,
"tasks": [task.get_json() for task in goal.tasks]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List comprehension! 😄

Comment on lines +16 to +21
completed_at = self.completed_at
if completed_at == None:
is_complete = False
else:
is_complete = True
return is_complete

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified to:

Suggested change
completed_at = self.completed_at
if completed_at == None:
is_complete = False
else:
is_complete = True
return is_complete
return self.completed_at != None

Comment on lines +20 to +30
if task.completed_at == None:
completed_at = False
else:
completed_at = True

tasks_response.append({
"id": task.task_id,
"title": task.title,
"description": task.description,
"is_complete": completed_at
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not clear on why you didn't use task.get_json here.

@kmanuponce
Copy link
Author

kmanuponce commented May 21, 2021 via email

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