Skip to content

Whales - Gaby Webb#110

Open
gabythedev wants to merge 16 commits intoada-c17:masterfrom
gabythedev:master
Open

Whales - Gaby Webb#110
gabythedev wants to merge 16 commits intoada-c17:masterfrom
gabythedev:master

Conversation

@gabythedev
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@kaidamasaki kaidamasaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

I noted a couple of small stylistic things but overall everything looks really solid.

Well done!

Comment thread app/models/goal.py
Comment on lines +10 to +14
goal_dict = {
"id": self.goal_id,
"title": self.title,
}
return goal_dict
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you immediately return this you don't need to assign it to a variable:

Suggested change
goal_dict = {
"id": self.goal_id,
"title": self.title,
}
return goal_dict
return {
"id": self.goal_id,
"title": self.title,
}

Comment thread app/models/task.py
Comment on lines +11 to +19
task_dict = {
"id": self.task_id,
"title": self.title,
"description": self.description
}
if self.completed_at is None:
task_dict["is_complete"] = False
else:
task_dict["is_complete"] = True
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified to:

Suggested change
task_dict = {
"id": self.task_id,
"title": self.title,
"description": self.description
}
if self.completed_at is None:
task_dict["is_complete"] = False
else:
task_dict["is_complete"] = True
task_dict = {
"id": self.task_id,
"title": self.title,
"description": self.description,
"is_complete": bool(self.completed_at)
}

Comment thread app/models/goal.py
title = db.Column(db.String)
tasks = db.relationship('Task', backref='goal', lazy=True)

def create_goal_dict(self):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Since this is a method on the Goal class having goal in the name is redundant:

Suggested change
def create_goal_dict(self):
def create_dict(self):

Comment thread app/routes.py
}
return response

def get_one_task_or_abort(task_id):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this helper function. It's really clearly named and clean. 😃

(You even have great error messages!)

Comment thread app/routes.py
"authorization": "Bearer " + os.environ.get("SLACKBOT_API_KEY")
}

post_message = requests.post(path, data=data, headers=headers)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Since you don't do anything with this variable it's a best practice not to store it:

Suggested change
post_message = requests.post(path, data=data, headers=headers)
requests.post(path, data=data, headers=headers)

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