-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cedar mac #78
base: master
Are you sure you want to change the base?
cedar mac #78
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool use of a keyword argument
No description provided.