Skip to content

Conversation

@mystioreo
Copy link

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 looked at customers.json to find the necessary fields for a customer and looked at movies.json to find the necessary fields for a movie. We made the rentals model as a join model based on information on the project website.
What would be the Big-O time complexity of your /customers & /movies endpoints? What does the time complexity depend on? Explain your reasoning. We think that our customers#index method runs in O(nlogn) because we implement a sorting method which has the largest time complexity compared to other operations in index The time complexity of customers#index depends on the number of customers in the database. We think that our movies#index method runs in 0(1) (constant time) because there is no sorting involved - movies#index only retrieves a list of movies.
What is the Big-O time complexity of the POST /rentals/check-in endpoint? What does the time complexity depend on? Explain your reasoning. rentals#checkin run in O(n) time complexity where n is the number of Rentals in the database. We think that the rails find_by method runs in linear time because it has to search through the list of Rentals one by one.
Describe a set of positive and negative test cases you implemented for a model. For Customer validations, we tested that a customer would be valid with a name and invalid without a name.
Describe a set of positive and negative test cases you implemented for a controller. For movies#show, we tested that it would respond with json with the correct fields given a valid id. We then tested that it would respond with not found given an invalid id.
How does your API respond when bad data is sent to it? We used an errors hash modeled after the example given in the project guidelines. Each hash is formatted consistently.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. We wrote movies_checked_out_count as a custom method for the Customer model. We decided to use a method rather than adding a column to the database because movies_checked_out_count needs to be calculated dynamically based on the current state of the Rentals table.
Do you have any recommendations on how we could improve this project for the next cohort? The Smoke Test instructions could use an update - they were a little hard to follow.
Link to Trello https://trello.com/b/tdTqoVpR/videostore-laura-daniela
Link to ERD https://www.lucidchart.com/invitations/accept/ceb8896d-a582-4c61-bcf1-cf8ea4d301bf
Summary

@CheezItMan
Copy link

Video Store

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Good number of commits, and good commit messages
Comprehension questions Check,
General
Business Logic in Models Some of your controller methods could be trimmed down by implementing logic in the models.
All required endpoints return expected JSON data Check
Requests respond with appropriate HTTP Status Code Check
Errors are reported Check
Testing
Passes all Smoke Tests Check
Model Tests - all relations, validations, and custom functions test positive & negative cases Check
Controller Tests - URI parameters and data in the request body have positive & negative cases Check
Overall Nicely done, you hit all the learning goals for the project. One note I have is that I would focus on putting more logic into the models.

# info << Movie.find_by(id: params[:id]).rentals.where(active:true) #name #postal_code
if movie
rentals = movie.rentals.where(active:true)
if rentals

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since rentals will be a collection, this should probably be if rentals.length > 0

# info << Movie.find_by(id: params[:id]).rentals.where(active:true) #name #postal_code
if movie
rentals = movie.rentals.where(active:false)
if rentals

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to above


if rentals.any?
overdues = []
rentals.each do |rental|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type of method would make an excellent model method.

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.

3 participants