Open
Conversation
added 14 commits
November 2, 2022 13:50
… completed_at type and value
…ute to Getting Tasks of One Goal
CheezItMan
reviewed
Dec 4, 2022
CheezItMan
left a comment
There was a problem hiding this comment.
Nice work Miranda, you hit the learning goals here. Well done. I left some minor comments in the code. Let me know if you have questions via slack.
Comment on lines
+16
to
+17
| if "title" not in response_body: | ||
| return jsonify({"details": "Invalid data"}), 400 |
There was a problem hiding this comment.
It's good that you're doing data validation, but you should probably indicate what data is invalid.
| @goal_bp.route("", methods=["GET"]) | ||
| def read_goal(): | ||
| goals = Goal.query.all() | ||
| response = [goal.return_body() for goal in goals] |
Comment on lines
+17
to
+22
| @classmethod | ||
| def from_dict(cls, data_dict): | ||
| if "title" in data_dict: | ||
| new_obj = cls(title=data_dict["title"]) | ||
| return new_obj | ||
|
|
There was a problem hiding this comment.
Good use of a class-method as a helper.
Comment on lines
+90
to
+101
| PATH = "https://slack.com/api/chat.postMessage" | ||
|
|
||
| SLACKBOT_TOKEN = os.environ.get("SLACKBOT_TOKEN") | ||
|
|
||
| # the query parameters come from the | ||
| query_params = { | ||
| "token": SLACKBOT_TOKEN, | ||
| "channel": "task-notifications", | ||
| "text": f"Someone just completed the task {task.title}" | ||
| } | ||
|
|
||
| requests.post(url=PATH, data=query_params, headers={"Authorization": SLACKBOT_TOKEN}) |
There was a problem hiding this comment.
The slack portion of this method might do well as a helper function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.