Open
Conversation
…ncies to include datetime, test wave 3 passing
…Slack API using slack_sdk package
…e, per instructions, rather than slack_sdk package
…, modifies GET method to /tasks to return goal_id as part of response
…nal in response to GET request
…factors routes.py to use new methods to DRY code
… method for readability
…s/<task_id> to use method
… to optional enhancements test file, adds a fixture to conftest.py to make these tests work
CheezItMan
reviewed
May 18, 2021
CheezItMan
left a comment
There was a problem hiding this comment.
Well done! You hit the learning goals here. Nice work. I like helper functions and the tests you added. Great job.
| title = db.Column(db.String) | ||
| tasks = db.relationship('Task', backref='goal', lazy=True) | ||
|
|
||
| def to_json(self): |
| task_info['goal_id'] = self.goal_id | ||
| return task_info | ||
|
|
||
| def from_json(self, request_body): |
Comment on lines
+12
to
+17
| def is_task_complete(self): | ||
| if not self.completed_at: | ||
| return False | ||
| return True | ||
|
|
||
| def get_task_info(self): |
| else: | ||
| tasks = Task.query.all() | ||
|
|
||
| return jsonify([task.get_task_info() for task in tasks]) |
Comment on lines
+42
to
+44
| sort_query = request.args.get("sort") | ||
| sort_by_id_query = request.args.get("sort_by_id") | ||
| filter_by_query = request.args.get("filter_by_title") |
Comment on lines
+143
to
+148
| try: | ||
| new_goal = Goal(title=request_body['title']) | ||
| except KeyError: | ||
| return make_response({ | ||
| "details": "Invalid data" | ||
| }, 400) |
| #### Helper Functions #### | ||
| ########################## | ||
|
|
||
| def post_to_slack(message): |
| pytz==2021.1 | ||
| requests==2.25.1 | ||
| six==1.15.0 | ||
| slack-sdk==3.5.1 |
There was a problem hiding this comment.
Since you're not using this anymore.
Suggested change
| slack-sdk==3.5.1 |
Comment on lines
+90
to
+93
| # This fixture gets called in optional enchancements tests | ||
| # that reference "three_goals". This fixture creates three | ||
| # goals and saves them in the database | ||
| @pytest.fixture |
| @@ -0,0 +1,175 @@ | |||
| def test_get_tasks_sorted_by_id(client, three_tasks): | |||
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.
With optional enhancements including additional tests and test configs