-
Notifications
You must be signed in to change notification settings - Fork 25
Aurea & Layla - Edges - VideoStoreAPI #9
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
add show method
Mvc setup
adding model testing
Layla work
Mvc setup
added checkout for rental and post route
change column to return date, add controller tests for check out
add rental controller test for check in
added additional methods for available inventory and movie count
Video StoreWhat We're Looking For
|
| #strong params | ||
| def customer_params | ||
| params.permit(:name, :registered_at, :address, :city, :state, :postal_code, :phone) | ||
| end |
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.
I don't think this method is used.
| describe "index" do | ||
|
|
||
| it "successfully gets list of customers" do | ||
| get customers_path |
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.
What if there are no customers?
| expect(body).must_include "errors" | ||
| end | ||
|
|
||
| describe "create" do |
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.
You forgot to end the previous describe block here.
|
|
||
| it "does not successfully update if invalid" do | ||
|
|
||
| @rental.destroy |
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.
What if the rental has already been checked in?
| it "does not successfully create if invalid" do | ||
|
|
||
| movie = Movie.find_by(id: rental_data[:movie_id] ) | ||
| movie.destroy |
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.
What if there is not enough inventory?
Video Store API
Congratulations! You're submitting your assignment!
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.
Comprehension Questions
n. Is it the number of customers, of movies, of rentals, the average number of rentals per customer...?Second, taking
moviesas an example, we know this endpoint looks at all the movies because that's what is sent back as JSON. So ifmis the total number of movies, then the time complexity is at leastO(m).Third, for each movie you call the
available_inventorymethod, looking the collection of rentals, which implies there's anrterm, whereris the number of rentals. This is where things start to get complicated, and depend on how postgres works - how long does it take to find the rentals for a given movie? Usually it's safe to assume that indexed data is organized using a tree, which means the time complexity isO(m log(r)).POST /rentals/check-inendpoint? What does the time complexity depend on? Explain your reasoning.O(log(r)), whereris the total number of rentals.