-
Notifications
You must be signed in to change notification settings - Fork 27
Time - Vicki and Alicia #14
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
Vicki wave1 video
aec-wave1-customers
added checkout function and test
…n, edited test file
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.
Good work on this project. Your code is well written and well tested. One smoke test failed -- the details in the rubric. It looks like you dealt with the situation of returning bad_request when the video inventory is 0, but not for an invalid video. Another thing to note is that you should put all business logic in the model. A good indicator of "business logic" is when you're manipulating data by adding or subtracting. Take a look and let me know if you have any questions. Keep up the hard work!
|
|
||
| if rental.save | ||
|
|
||
| rental.customer.videos_checked_out_count = rental.customer.videos_checked_out_count + 1 |
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 is business logic that deserves a custom model method.
| customer = Customer.find_by(id:rental_params[:customer_id]) | ||
| video = Video.find_by(id:rental_params[:video_id]) | ||
|
|
||
| customer.videos_checked_out_count = customer.videos_checked_out_count - 1 |
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.
Just as with check_out, you should encapsulate this logic with custom model methods(s)
Video Store APIMajor Learning Goals/Code Review
Functional Requirements
Overall Feedback
Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
|
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.