Skip to content

Water - India & Jessica#34

Open
jwinchan wants to merge 33 commits intoAda-C14:masterfrom
jwinchan:master
Open

Water - India & Jessica#34
jwinchan wants to merge 33 commits intoAda-C14:masterfrom
jwinchan:master

Conversation

@jwinchan
Copy link

@jwinchan jwinchan commented Dec 4, 2020

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

Prompt Response
Explain how you came up with the initial design of your ERD, based on the seed data and reading through the API endpoints We created the controllers/models based on the seed data (video and customer), and then created the methods based on the API endpoints. We knew we needed to create rentals model to relate the video and customer and the controller to match the API endpoints.
What would be the Big-O time complexity of your /customers & /videos endpoints? What does the time complexity depend on? Explain your reasoning. time complexity for the index methods is O(n) because we iterate through each object and render it as json, which will out an array of hashes. The time complexity for the show method is also O(n) because we iterate through the json array to find the individual video to render. The time complexity depends on how many customer or video objects there are. The create method is O(n) time complexity that depends on the number of params being input.
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+m) because of the .find_by methods applied to Video and Customer. Because each class can have arrays of different sizes, the time complexity is dependent on each array's size.
Describe a specific set of positive and negative test cases you implemented for a model. When testing the validations in the video model, we tested the positive case of having all fields filled in, and then tested the negative case of having one of the fields missing. The video object should be valid in the positive case and invalid in the negative case.
Describe a specific set of positive and negative test cases you implemented for a controller. For the rental checkout method, the positive case is that we successfully create a rental with valid parameters. For the negative case, we expect it will respond with "not found" if either a video or customer doesn't exit. We also tested for the negative case of what happens when the checkout is requested on a video with not enough inventory.
Broadly, describe how an API should respond when it handles a request with invalid/erroneous parameters. It should render a json that has the appropriate error messages. It should also return a request status in 4xx.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. We created custom methods in the customers model to handle increasing and decreasing videos_checked_out_count. We chose to wrap this into a method to dry up our controller code, and we placed it in the customer model because it directly handles the customer data.

indiakato and others added 30 commits December 2, 2020 09:05
edited controller methods to match smoke tests
created rentals fixtures and tested videos validations and relations
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

Comments