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

Shark - Ying #98

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

Shark - Ying #98

wants to merge 12 commits into from

Conversation

yingsgithub
Copy link

Finished all waves

Copy link

@audreyandoy audreyandoy 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 Ying! Your code was very clean due to your well-written helper functions.

You have earned a 🟢 green grade for this project.

In this PR, you'll find comments focused on compliments and suggestions for refactoring. With internship in a few months, I'd like you to submit PRs as if a manager is reviewing your code. So in this case, removing unneeded whitespace, unused code, and unused imports are all things that should be removed prior to submitting a PR to be reviewed. Let's practice that in future projects!

Keep up the great work! 🦈 ✨

Comment on lines +36 to +39
from app.routes.routes import tasks_bp
app.register_blueprint(tasks_bp)
from app.routes.goal_routes import goals_bp
app.register_blueprint(goals_bp)

Choose a reason for hiding this comment

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

Good work in organizing your routes into separate files. My one minor suggestion is to change the routes file name to task_routes.

Comment on lines +5 to +7
goal_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
title = db.Column(db.String)
tasks = db.relationship("Task", back_populates="goal", lazy = True)

Choose a reason for hiding this comment

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

👍 Nice work making the Goal class! We may want to consider whether we should storing empty/null titles for a goal is useful (should goals have no titles?). How might we change line 6, title = db.Column(db.String) to prevent null values?

Comment on lines +8 to +9


Choose a reason for hiding this comment

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

We can get rid of extra whitespace

Comment on lines +11 to +22
def to_json(self):
return {
"id": self.goal_id,
"title": self.title
}

@classmethod
def create_goal(cls, req_body):
new_goal = cls(
title = req_body["title"],
)
return new_goal

Choose a reason for hiding this comment

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

👍


class Task(db.Model):
task_id = db.Column(db.Integer, primary_key=True)
id = db.Column(db.Integer, primary_key=True, )

Choose a reason for hiding this comment

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

We may want to add autoincrement=True just to communicate to other developers that the id is being autoincremented by postgres/SQLAlchemy

Comment on lines +60 to +62
assert response_body == {"message": "Goal1 not found"}
# assertion 2 goes here
assert response.status_code == 404

Choose a reason for hiding this comment

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

👍

Comment on lines +89 to +104
response = client.put("/goals/1", json={
"title": "Updated goal title"
})
response_body = response.get_json()

# Assert
# ---- Complete Assertions Here ----
# assertion 1 goes here
# assertion 2 goes here
# assertion 3 goes here
# ---- Complete Assertions Here ----
assert response.status_code == 200
assert "goal" in response_body
assert response_body == {
"goal": {
"id": 1,
"title": "Updated goal title"
}
}
goal = Goal.query.get(1)
assert goal.title == "Updated goal title"

Choose a reason for hiding this comment

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

👍

Comment on lines +110 to +119
# raise Exception("Complete test")
# Act
# ---- Complete Act Here ----

response = client.put("/goals/1", json={
"title": "Updated Goal Title",
})
response_body = response.get_json()

# Assert
# ---- Complete Assertions Here ----
# assertion 1 goes here
# assertion 2 goes here
# ---- Complete Assertions Here ----
assert response.status_code == 404
assert response_body == {'message': 'Goal1 not found'}

Choose a reason for hiding this comment

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

👍

Comment on lines +150 to +155
response = client.delete("/goals/1")
response_body = response.get_json()

# Assert
# ---- Complete Assertions Here ----
# assertion 1 goes here
# assertion 2 goes here
# ---- Complete Assertions Here ----
assert response_body == {'message': 'Goal1 not found'}
assert Goal.query.all() == []

Choose a reason for hiding this comment

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

👍

# **Complete test with assertion about response body***************
# *****************************************************************
# raise Exception("Complete test with assertion about response body")
assert response_body == {"message": "Goal1 not found"}

Choose a reason for hiding this comment

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

👍

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