Skip to content

Conversation

@faezeh-ashtiani
Copy link

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 looked at what fields were required for video and customer based on the seed data, and for rentals we based the fields on the API requirements.
What would be the Big-O time complexity of your /customers & /videos endpoints? What does the time complexity depend on? Explain your reasoning. it is O(n) depending on the length of the collection.
What is the Big-O time complexity of the POST /rentals/check-in endpoint? What does the time complexity depend on? Explain your reasoning. finding video and customer are O(1) operations. (tables function like arrays) and the posting of the new rental is also O(1).
Describe a specific set of positive and negative test cases you implemented for a model. we tested that a video or customer can be created when it has all the necessary fields, and then won't be created if any of the fields with "presence" are nil.
Describe a specific set of positive and negative test cases you implemented for a controller. in customer controller -> positive test returns and array of all the customers and the edge test was that it returns an empty array when there are no customers.
Broadly, describe how an API should respond when it handles a request with invalid/erroneous parameters. it should respond with the respond code and return the error messages to the user.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. we have not created custom model methods, but if our design did not have rentals model, the check-in and check-out methods could have been business logic.

@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 The answer to the reflection question is vague. What response code(s) would be appropriate to respond with in this context?
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! Seriously, it's a yellow because of the specific code review points the rubric touches on based on the new learning objectives, but regardless y'all built a fully functional API and you should be proud of that!

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 +3 to +6
new_rental = Rental.new(rentals_params)
new_rental.checkout_date = Date.today
new_rental.due_date = Date.today + 7.days
new_rental.return_date = nil

Choose a reason for hiding this comment

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

This is stuff that would be appropriate to move to a method on the rental model.

Comment on lines +27 to +28
video.available_inventory -= 1
video.save

Choose a reason for hiding this comment

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

I know this is only two lines, but it could be one line in the controller if there were a method to do this in the video model.

Comment on lines +32 to +33
customer.videos_checked_out_count += 1
customer.save

Choose a reason for hiding this comment

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

Same here for the customer model

end
end

def checkin

Choose a reason for hiding this comment

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

There are opportunities to move things to models in this method as well.
As a general rule, any time I see more than one line of code that isn't directly related to the user-control-flow of the application, I ask myself: "could I pull this code out into a model?

Choose a reason for hiding this comment

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

Feel free to reach out if that isn't totally clear!

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