-
Notifications
You must be signed in to change notification settings - Fork 27
Space Nikki && Lak #10
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
base: master
Are you sure you want to change the base?
Conversation
…er to pass the smoke test
Video Store APIMajor Learning Goals/Code Review
Functional Requirements
Overall Feedback
Additional FeedbackGreat work y'all! You built a fully-functional API! Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
|
| if rental.save | ||
|
|
||
| customer.videos_checked_out_count += 1 | ||
| customer.save | ||
| video.available_inventory -= 1 | ||
| video.save |
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.
This logic would be appropriate to put in models.
As a general rule, any time I see more than one line of code that isn't directly related to the user-control-flow of the application, I ask myself: "could I pull this code out into a model?"
| else | ||
| render json: { | ||
| errors: rental.errors.messages | ||
| }, status: :bad_request |
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.
There's actually no chance that the request could be bad at this point because the customer_id and video_id have already been verified on lines 4 & 5.
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.
Hence you don't have a unit test that verifies this case.
Assignment Submission: Video Store API
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
If you didn't get to the functionality the question is asking about, reply with what you would have done if you had completed it.
Reflection
/customers&/videosendpoints? What does the time complexity depend on? Explain your reasoning.POST /rentals/check-inendpoint? What does the time complexity depend on? Explain your reasoning.POST /rentals/check-in, the time complexity is O(n), and it depends on number of rentals.