Conversation
beccaelenzil
left a comment
There was a problem hiding this comment.
Great work on this complex Flask project! You've done a great job researching new methods to make your code clear and concise. Nice work pushing yourself to learn new things. I've left a few in-line comments on ways you could consider refactoring. One minor note: it looks like you missed writing wave05 tests -- these may have been lost in the git debacle. Please let me know if you have any questions 🥳
|
|
||
| return response | ||
|
|
||
| def update(self, request_body): |
There was a problem hiding this comment.
Nice work creating this DRY, flexible helper method!
| pretty much the same for Task & Goals. | ||
| Not sure if this is a no no in real life, or if there is a better way to do it. Let me know! |
There was a problem hiding this comment.
This looks good to me! Nice use of before_request
| goals_bp = Blueprint("goals", __name__, url_prefix="/goals") | ||
|
|
||
|
|
||
| def slack_bot(text): |
There was a problem hiding this comment.
Nice work creating a helper function. You might consider refactoring as an instance method on task given that the text has information about a specific task.
| return model.query.get_or_404(id) | ||
|
|
||
|
|
||
| def sort(model): |
There was a problem hiding this comment.
Nice work breaking this out into a helper function
| model, name = g.model, g.name | ||
| request_body = request.get_json() | ||
|
|
||
| try: |
There was a problem hiding this comment.
This works, and is very concise! You might consider refactor to check for the specific missing column information to provide these details to the user.
| request_body = request.get_json() | ||
|
|
||
| try: | ||
| goal.tasks = [validate(Task, task_id) for task_id in request_body["task_ids"]] |
There was a problem hiding this comment.
Nice use of validate within this list comprehension for clear and concise code.
| @goals_bp.route("/<goal_id>/tasks", methods=["GET"]) | ||
| def get_tasks_by_goal(goal_id): | ||
| goal = validate(Goal, goal_id) | ||
| return goal.to_dict(has_tasks=True) |
No description provided.