Skip to content

Cassy and Shelan's VideoStoreAPI#15

Open
sheland wants to merge 78 commits intoAda-C10:masterfrom
cassyarchibald:master
Open

Cassy and Shelan's VideoStoreAPI#15
sheland wants to merge 78 commits intoAda-C10:masterfrom
cassyarchibald:master

Conversation

@sheland
Copy link

@sheland sheland commented Nov 9, 2018

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

Question Answer
Explain how you came up with the design of your ERD, based on the seed data. We created 3 models while reviewing the seed files. We listed all the attributes for each model and how they related to on another. After debating we decided to have "Rental" as a joint model since it had its own attributes.
What would be the Big-O time complexity of your /customers & /movies endpoints? What does the time complexity depend on? Explain your reasoning. For customer we provided all the customers by name which is O(n) . The movie check-out method selects all rentals based on a condition, this would be O(n). The final complexity would be O(n). For movies we are getting all the movies through the index action, this would be O(n) as well.
What is the Big-O time complexity of the POST /rentals/check-in endpoint? What does the time complexity depend on? Explain your reasoning. We are finding the rental by the customer's and movie's id through an array of rental, this would be O(n). When then call in the check-in method which resets a value, the final time complexity would be O(n)
Describe a set of positive and negative test cases you implemented for a model. For the customer model, we created 2 tests for checking the movie check-out count. It increases when a rental is created and decreases when a movie is checked out.
Describe a set of positive and negative test cases you implemented for a controller. We tested the show method with valid and invalid data. We also tested if a movie and rental can be created with valid params and invalid params.
How does your API respond when bad data is sent to it? For Movie's show action, we render a not found status with when invalid params are used. When creating a movie with invalid params, we throw and error message and a bad request status. This also applies for the check-in and check-out methods.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. We created a "check-in!" method that set the checkin date to today's date and saves it. This is located in the Rental model and called in the Rental controller because we wanted to separate our logic from the controller and model.
Do you have any recommendations on how we could improve this project for the next cohort? Remind student the importance of resetting the database when testing with Postman. We created a custom validation for movies where it cannot be rented if the available inventory is less than 0. Our postman test ended up renting the movie it was using for a test to the point where there was no available movies left for that movie. Eventually we resolved this issue by resetting our database. We thought it was interesting that we were not able to identify a rental by its id but instead of multiple ids from different models. It would be nice if the rental post requests could include an id.
Link to Trello https://trello.com/b/iS7G3Jnh/videostoreapi
Link to ERD https://trello.com/c/A4PyogBj/8-erd
Summary This project was enjoyable, we were able to play around and try new things like Rabl since time was not a big constraint. We enjoyed debugging/creating helper methods/combining methods.

cassyarchibald and others added 30 commits November 7, 2018 13:42
…cked out. Will remove those from schema. Corrected test for movie show keys. Added validation to rental for movie with no available inventory
…nt so only rentals with nil for checkin are selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants