-
Notifications
You must be signed in to change notification settings - Fork 71
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
Scissors / Raquel Mena / task list api #61
base: master
Are you sure you want to change the base?
Conversation
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.
Code looks great! Just one little suggestion for improvement I've been offering to people!
def task_completed(self): | ||
if self.completed_at: | ||
return True | ||
else: | ||
return False | ||
|
||
def return_task_json(self): | ||
task_dict = { |
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.
Love the helper methods!
task.goal_id = goal.goal_id | ||
|
||
db.session.commit() | ||
return make_response({"id": goal.goal_id, "task_ids": request_body["task_ids"]}), 200 |
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.
This change would have made the above-mentioned bug more obvious. This would also allow the response to include ALL tasks associated with the goal, not just the new ones.
This isn't super intuitive so I'd definitely be down to talk through this more in our next 1:1
return make_response({"id": goal.goal_id, "task_ids": request_body["task_ids"]}), 200 | |
full_task_ids = [] | |
for task in goal.tasks: | |
full_task_ids.append(task.task_id) | |
return make_response({"id": goal.goal_id, "task_ids": full_task_ids}, 200) |
No description provided.