-
Notifications
You must be signed in to change notification settings - Fork 61
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
C17 Sea turtles, Celina Barron, Shelby Faulconer, and Tiffini Hyatt #13
base: main
Are you sure you want to change the base?
Conversation
…anet list on routes.py
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 y'all! I've left a few comments, please reach out if you have any questions on the feedback 🙂
app/routes.py
Outdated
} | ||
) |
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.
If the opening brackets are stacked together, I'd recommend doing the same with the closing brackets to be consistent.
app/routes.py
Outdated
planet_list.append({ | ||
"id" : planet.id, | ||
"name" : planet.name, | ||
"description" : planet.description, | ||
"distance from sun" : planet.dist_from_sun | ||
} | ||
) |
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.
To reduce repetition, we could reuse Planet's to_dict
function here:
planet_list.append(planet.to_dict())
return planet.to_dict() | ||
|
||
|
||
def validate_planet(planet_id): |
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.
I'd consider renaming this function. To me, validate_planet
sounds like it should return a true/false based on if the planet passed as a parameter is valid. What name might better describe what the function is doing?
app/routes.py
Outdated
planets = [ | ||
Planet(1, "Mercury", "rocky", 1), | ||
Planet(2, "Venus", "rocky", 2), | ||
Planet(3, "Earth", "water", 3), | ||
Planet(4, "Mars", "red", 4), | ||
Planet(5, "Jupiter", "big", 5), | ||
Planet(6, "Saturn", "rings", 6), | ||
Planet(7, "Uranus", "butt", 7), | ||
Planet(8, "Neptune", "ice", 8), | ||
Planet(9, "Pluto", "dwarf", 9) | ||
] |
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.
I see what you did there 😆
app/routes.py
Outdated
if planet.id == planet_id: | ||
return planet | ||
|
||
abort(make_response({"message": f"planet {planet_id} not found"}, 404)) |
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 error handling in the helper function!
Waves 1 and 2