Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

cedar mac #78

wants to merge 6 commits into from

Conversation

mac-madison
Copy link

No description provided.

Copy link

@beccaelenzil beccaelenzil left a 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):

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!

Comment on lines +11 to +12
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!

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):

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):

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:

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"]]

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)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants