Skip to content

Dianna and Michaela#22

Open
dtingg wants to merge 42 commits intoAda-C12:masterfrom
dtingg:master
Open

Dianna and Michaela#22
dtingg wants to merge 42 commits intoAda-C12:masterfrom
dtingg:master

Conversation

@dtingg
Copy link

@dtingg dtingg commented Nov 8, 2019

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 models based on the seed data categories (movie and customer) and added columns based on the seed data attributes. We also added a third model for rental and used has-many-through to connect all three models through rental.
What would be the Big-O time complexity of your /customers & /movies endpoints? What does the time complexity depend on? Explain your reasoning. Our customers index is O(n*m), where n is the number of customers and m is the total number of rentals. We loop through all of the customers to get their data for the index and within that loop, we look through all of their rentals to find how many are active. For our movies index, the Big-O time complexity is O(n) because we loop through all of the movies in order to return their data.
What is the Big-O time complexity of the POST /rentals/check-in endpoint? What does the time complexity depend on? Explain your reasoning. The time complexity is O(n), where n is the total number of rentals because we have to look through all of the rentals to find which ones match the check in request.
Describe a set of positive and negative test cases you implemented for a model. For our movie model's available inventory method, the positive case is when one copy of a movie is checked out, available inventory returns the movie's inventory minus one. The corresponding negative case is when no copies of the movie are checked out, the movie's available inventory is the same as its inventory.
Describe a set of positive and negative test cases you implemented for a controller. For our rentals controller's check out method, our positive case is when a valid customer checks out a valid movie, it responds with a successful JSON response and it creates a rental for the given customer and movie. One of the negative cases is when an invalid customer is passed as a parameter, it responds with bad_request and gives an error message.
How does your API respond when bad data is sent to it? It responds with a negative status such as bad_request or not_found and returns error message(s).
Describe one of your custom model methods and why you chose to wrap that functionality into a method. In the customer model, we have a movies_checked_out count so it gets calculated on demand instead of being stored in the database. We realized it would be inefficient to be constantly sending update requests to the database, and there is a risk that the database could get out of sync with the correct count.
Do you have any recommendations on how we could improve this project for the next cohort? It would be helpful if you synced up the Leaves and Branches schedules for this week so that project time is always at the same time.
Link to Trello https://trello.com/b/TnujKHr8/videostoreapi
Link to ERD https://www.lucidchart.com/invitations/accept/79aedbd3-8f56-42df-aafd-f4c74b09811c
Summary We are excited that we have logic to accurately calculate and update the customer's movies_checked_out_count and the movie's available_inventory based on the rentals and their status. We are also happy that we added query parameters for sort and paginate to our customers index action!

dtingg added 30 commits November 5, 2019 14:01
…ecked_out_count in customer model; added column check_in_date to rentals table
@beccaelenzil
Copy link

Video Store

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene yes
Comprehension questions yes
General
Business Logic in Models
All required endpoints return expected JSON data yes
Requests respond with appropriate HTTP Status Code yes
Errors are reported yes
Testing
Passes all Smoke Tests yes
Model Tests - all relations, validations, and custom functions test positive & negative cases yes
Controller Tests - URI parameters and data in the request body have positive & negative cases yes
Overall Great work! Your code is well written and well tested. Your tests for the check-out and check-in actions are especially thorough. Keep up the hard work.

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