Skip to content

Sharks- Ivana M. and Lauren K.#14

Open
lkleinert wants to merge 12 commits intoada-c17:mainfrom
maldonado-ivana:main
Open

Sharks- Ivana M. and Lauren K.#14
lkleinert wants to merge 12 commits intoada-c17:mainfrom
maldonado-ivana:main

Conversation

@lkleinert
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@spitsfire spitsfire left a comment

Choose a reason for hiding this comment

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

Part 1! Nicely done! Left a few suggestions here and there, but your logic looks good

Comment thread app/models/planet.py
description = db.Column(db.String)
order_in_ss = db.Column(db.String)

def to_json(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.

👍 yay instance methods!

Comment thread app/routes.py Outdated



planets_bp = Blueprint("planets", __name__, url_prefix = "/planets")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we only need this assigned once at the top!

Suggested change
planets_bp = Blueprint("planets", __name__, url_prefix = "/planets")

Comment thread app/routes.py Outdated
Comment on lines +27 to +28
for planet in planets:
planets_response.append(planet.to_json())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we could also do this with list comprehension:

Suggested change
for planet in planets:
planets_response.append(planet.to_json())
planets_response = [planet.to_json() for planet in planets]

Comment thread app/routes.py Outdated
for planet in planets:
planets_response.append(planet.to_json())

return jsonify(planets_response)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

don't forget your status codes!

Suggested change
return jsonify(planets_response)
return jsonify(planets_response), 200

Copy link
Copy Markdown

@spitsfire spitsfire left a comment

Choose a reason for hiding this comment

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

Nicey done, Ivana and Lauren! I didn't find any red flags or any logic issues! Looks good!

Comment thread app/models/planet.py
"order in solar system": self.order_in_ss
}

def update_planet(self, update_body):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread app/models/planet.py
self.order_in_ss = update_body["order in solar system"]

@classmethod
def create_planet(cls, request_body):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread app/routes/helpers.py
@@ -0,0 +1,14 @@
from flask import abort, make_response
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 great job separating this out!

Comment thread app/models/planet.py
new_planet = cls(
name=request_body['name'],
description=request_body['description'],
order_in_ss=request_body['order in solar system'],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

careful with spaces! while this works syntactically, I don't think it's very common to see keys with spaces like this. Maybe something like order_in_ss might look better

Comment thread app/routes/routes.py
@@ -0,0 +1,55 @@
from app import db
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread app/tests/conftest.py
@@ -0,0 +1,41 @@
import pytest
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread app/tests/test_routes.py
@@ -0,0 +1,64 @@
def test_get_all_planets_with_no_records(client):
Copy link
Copy Markdown

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.

3 participants