Conversation
Vicki wave1 video
aec-wave1-customers
added checkout function and test
…n, edited test file
There was a problem hiding this comment.
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.
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.
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.