Skip to content

Conversation

@Raque-lita
Copy link

No description provided.

Copy link

@jmaddox19 jmaddox19 left a 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!

Comment on lines +13 to +20
def task_completed(self):
if self.completed_at:
return True
else:
return False

def return_task_json(self):
task_dict = {

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

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

Suggested change
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)

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