Skip to content

Time - Yoyo and Yesenia#23

Open
ydunbar wants to merge 26 commits intoAda-C13:masterfrom
ydunbar:master
Open

Time - Yoyo and Yesenia#23
ydunbar wants to merge 26 commits intoAda-C13:masterfrom
ydunbar:master

Conversation

@ydunbar
Copy link

@ydunbar ydunbar commented May 30, 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 read the Wiki and saw that there would be a Rental that would belong to a Customer and a Video, and Customers may have many Rentals and Videos may have many Rentals, and that is what informed our ERD.
What would be the Big-O time complexity of your /customers & /videos endpoints? What does the time complexity depend on? Explain your reasoning. We think it's O(n) for each, because we are listing all of the customers and videos which is a linear operation dependent on how many customers and videos we have.
What is the Big-O time complexity of the POST /rentals/check-in endpoint? What does the time complexity depend on? Explain your reasoning. When we are searching for the video and customer by their id, we are assuming that we are using a binary search and that the customers and videos are sorted in the database, so that search would be a O(log n) complexity. And then when we check whether the customer or video is nil, that is a O(1), and when we render the JSON once, that's O(1). So overall it's a O(log n) complexity.
Describe a specific set of positive and negative test cases you implemented for a model. For Customer, a positive case is when a customer's name and phone number is present, and a negative case is when either of those are absent.
Describe a specific set of positive and negative test cases you implemented for a controller. When we go to a Video's Show endpoint, we have a positive case where we return a hash with all of the expected fields. In a negative case where a video of that ID doesn't exist, we return a 404 not found message.
Broadly, describe how an API should respond when it handles a request with invalid/erroneous parameters. An API should respond with a 404 not found error if the thing we are looking for doesn't exist. An API should respond with a 400 bad request when a user is attempting to post something with parameters that violate our validation requirements.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. For Video, we created the increase_inventory and decrease_inventory methods in order to keep business logic out of the controller.

ydunbar and others added 26 commits May 26, 2020 16:49
@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

Y'all, the testing here is so incredibly thorough! Great work!!

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

Comment on lines +18 to +24
it "responds with JSON and success" do
# Act
get customers_path

# Assert
check_response(expected_type: Array)
end

Choose a reason for hiding this comment

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

These tests are great! The one piece of feedback I'd give is that this test is unnecessary since you do all these things (including the assertions) in the other two tests.

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