Conversation
… a failed video controller test
Fixed the bug. It was impossible to find a Rental by a video and customer id
Tests for rental check-in
Video Store APIMajor Learning Goals/Code Review
Functional Requirements
Overall Feedback
Comprehension Questions
Because you created indexes for these this actually winds up being a O(log(n)) operation, which is pretty efficient. It would be O(n) if you hadn't created indexes on your foreign keys. (Databases use B-Trees for things like indexes, hence the logarithmic search.) Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
|
kaidamasaki
left a comment
There was a problem hiding this comment.
Excellent job! I really like how you handled your check in/out. It's very clean and elegant.
I've got a few style notes but other than that everything looks great!
| @@ -0,0 +1,12 @@ | |||
| class Customer < ApplicationRecord | |||
| has_many :rentals | |||
| has_many :videos, :through => :rentals | |||
There was a problem hiding this comment.
Style: I'd probably update this line to match the ones below.
| has_many :videos, :through => :rentals | |
| has_many :videos, through: :rentals |
| belongs_to :customer | ||
| belongs_to :video | ||
|
|
||
| def self.inventory_check_out(rental) |
There was a problem hiding this comment.
Style: I would have made these instance methods since you pass an instance in anyway.
| return true | ||
| else | ||
| return false |
There was a problem hiding this comment.
I really like returning a boolean value to indicate success or failure here though.
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.