C17 Sea turtles, Celina Barron, Shelby Faulconer, and Tiffini Hyatt#13
Open
pickled-bot wants to merge 26 commits intoada-c17:mainfrom
Open
C17 Sea turtles, Celina Barron, Shelby Faulconer, and Tiffini Hyatt#13pickled-bot wants to merge 26 commits intoada-c17:mainfrom
pickled-bot wants to merge 26 commits intoada-c17:mainfrom
Conversation
…anet list on routes.py
app/routes.py
Outdated
Comment on lines
44
to
45
| } | ||
| ) |
There was a problem hiding this comment.
If the opening brackets are stacked together, I'd recommend doing the same with the closing brackets to be consistent.
app/routes.py
Outdated
Comment on lines
39
to
45
| 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.
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.
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
Comment on lines
21
to
31
| 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) | ||
| ] |
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.
Great error handling in the helper function!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Waves 1 and 2