Skip to content

Conversation

@thenora
Copy link

@thenora thenora commented May 29, 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 The API Endpoints were really helpful to help decide between two models and three. The fact that rental needed to have it's own unique data, meant that a join table wasn't a good fit. But we knew that a customer could have rented many videos, and a video could have been rented by many customers so we needed to have an indirect many-to-many relationship.
What would be the Big-O time complexity of your /customers & /videos endpoints? What does the time complexity depend on? Explain your reasoning. Since these endpoints are listing all of the customers and videos, the big O is O(n) with n representing the number of videos or customers.
What is the Big-O time complexity of the POST /rentals/check-in endpoint? What does the time complexity depend on? Explain your reasoning. There are three expensive searches during the checkin. First, we need to validate the customer and video. Then we need to find the rental. These are all using the primary keys for the tables. So, I assume a binary tree search with an O(log n), where n is the number of items in each table. The rest of the work including the update to the rental record is constant O(1).
Describe a specific set of positive and negative test cases you implemented for a model. For the video validations, we used a positive test to say that if all the required fields were present, it would be a valid instance. We used negative tests to say that if a required column was missing, it would not be a valid instance.
Describe a specific set of positive and negative test cases you implemented for a controller. On the positive side, there are tests to create a rental and confirm that it increases customer checkout count, decreases inventory, and sets the right due date. On the negative side, it checks for invalid video id and customer id.
Broadly, describe how an API should respond when it handles a request with invalid/erroneous parameters. It should return a suitable status (like 404) and a matching error message.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. We initially calculated the rental due date in the controller, but later we created a checkout_update method in the rental model that takes a date parameter, adds seven days and updates the rental. This keeps the business logic in the model.

@jmaddox19
Copy link

Video Store API

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Practices git with at least 10 small commits and meaningful commit messages ✔️
Understands the importance of how APIs handle invalid/erroneous data in their reflection questions ✔️
Practices Rails best practices and well-designed separation, and encapsulates business logic around check-out and check-in in models ✔️
Uses controller tests to ensure quality code for every route, and checks for response status and content, with positive cases and negative cases ✔️
Uses controller tests to ensure correctness for check out and check in requirement, and that checked out counts and inventories appropriately change ✔️

Functional Requirements

Functional Requirement yes/no
All provided smoke tests for Wave 1 pass ✔️
All provided smoke tests for Wave 2 pass ✔️

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 3+ in Code Review && 2 in Functional Requirements ✔️
Yellow (Approaches Standards) 2+ in Code Review && 1+ in Functional Requirements, or the instructor judges that this project needs special attention
Red (Not at Standard) 0-1 in Code Review or 0 in Functional Reqs, or assignment is breaking/doesn’t run with less than 5 minutes of debugging, or the instructor judges that this project needs special attention

Additional Feedback

Great work! Y'all made a fully-functional API! And with such clean code and thorough testing!

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Elegant/Clever
Descriptive/Readable
Concise
Logical/Organized

return
end

if !rental.checkedin?

Choose a reason for hiding this comment

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

So smart to check this!

else
render json: {
errors: ["Not Found"]},
status: :not_found

Choose a reason for hiding this comment

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

There's actually no chance that the request could be bad at this point because the customer_id and video_id have already been verified on line 7. Hence you don't have a unit test that verifies this case.

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