Aurea & Layla - Edges - VideoStoreAPI#9
Open
lbristol88 wants to merge 40 commits intoAda-C10:masterfrom
Open
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.
I don't think this method is used.
| describe "index" do | ||
|
|
||
| it "successfully gets list of customers" do | ||
| get customers_path |
| expect(body).must_include "errors" | ||
| end | ||
|
|
||
| describe "create" do |
There was a problem hiding this comment.
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.
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.
What if there is not enough inventory?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.