Conversation
beccaelenzil
left a comment
There was a problem hiding this comment.
Your code for Waves 01-02 is strong. You've made good use of instance methods and helper functions. I've left a few in-line comments for you to review. Please let me know if you have any questions and we'll talk more in our 1:1.
| "id": self.task_id, | ||
| "title": self.title, | ||
| "description": self.description, | ||
| "is_complete": self.completed_at is not None |
There was a problem hiding this comment.
This is a clever way to turn self.completed_at into a boolean!
| "is_complete": self.completed_at is not None | ||
| } | ||
|
|
||
| def post_message_on_slack(self): |
There was a problem hiding this comment.
Good work making this a instance method.
| 'channel': "task_notifications", | ||
| 'text': f"Someone just completed the task: {self.title}" | ||
| } | ||
| requests.post(url, data) No newline at end of file |
There was a problem hiding this comment.
It looks like there's a small error here. The syntax for sending a request body is requests.pos(url, data=data) https://docs.python-requests.org/en/latest/user/quickstart/#make-a-request
| requests.post(url, data) | |
| requests.post(url, data=data) |
| @tasks_bp.route("/<task_id>/mark_complete", methods=["PATCH"]) | ||
| def mark_complete_on_incomplete_task(task_id): | ||
|
|
||
| task = get_task_from_id(task_id) | ||
|
|
||
| task.completed_at = datetime.date.today() | ||
| db.session.commit() | ||
|
|
||
| task.post_message_on_slack() | ||
| ####i do not know what is missing here### | ||
|
|
||
| @tasks_bp.route("/<task_id>/mark_incomplete", methods=["PATCH"]) | ||
| def mark_incomplete_on_complete_task(task_id): | ||
| task = get_task_from_id(task_id) | ||
|
|
||
| task.completed_at = None | ||
| db.session.commit() |
There was a problem hiding this comment.
These two methods still need to return a response. All route functions are required to return something. It can simply be a response code, but we should look to our tests for what exactly the response should be.
No description provided.