Skip to content

Conversation

@Shonda860
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 took the approach of thinking we were actually customers in the transaction to see how the relationships worked with rentals and videos. We did use ERD lucid chart by walking through the actual transaction. We were able to find that rentals belonged to customers and videos and etc. relationships. https://app.lucidchart.com/documents/edit/8150c414-8e92-428e-a10d-672abee5aae5/0_0?shared=true
What would be the Big-O time complexity of your /customers & /videos endpoints? What does the time complexity depend on? Explain your reasoning. 0(n) n represents the customers and videos and will take n time to populate.
What is the Big-O time complexity of the POST /rentals/check-in endpoint? What does the time complexity depend on? Explain your reasoning. O(n) because we are running a find by. iterates between the instances of that Class.
Describe a specific set of positive and negative test cases you implemented for a model. In the video test, we tested for valid creations of videos and invalid videos. We also tested that we were truly receiving integers.
Describe a specific set of positive and negative test cases you implemented for a controller. In the rental controller, we tested that we were actually able to change the video count. Also, we tested that the customer video_check_out_count decreased when I'm an item was checked in, and the actual video available_inventory actually increased. That caught three cases in only a few separate tests.
Broadly, describe how an API should respond when it handles a request with invalid/erroneous parameters. Should output a JSON key that gives you the error and message.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. We wrote a checkout method on rental models, and we initially realized we had a lot of code in that method. So we added two helper methods on the customer model and video model that allowed us to increment/decrement the values of rented movies.l

@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 ✔️ Yes, though I would recommend committing in even smaller chunks
Understands the importance of how APIs handle invalid/erroneous data in their reflection questions The question could have been more clear but we were looking for more specificity about what HTTP status codes would be returned and what the errors would look like.
Practices Rails best practices and well-designed separation, and encapsulates business logic around check-out and check-in in models ✔️ Yes! The model methods look so good!
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 built a fully functional API!
The code is seriously organized the way I would expect a seasoned engineer to organize it! And the tests are remarkably thorough!

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

Copy link

@jmaddox19 jmaddox19 left a comment

Choose a reason for hiding this comment

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

Great work!

@@ -0,0 +1,34 @@
class Rental < ApplicationRecord

Choose a reason for hiding this comment

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

Both of the custom methods here are so well-written!

Comment on lines +15 to +16
self.available_inventory = video.available_inventory
self.videos_checked_out_count = customer.videos_checked_out_count

Choose a reason for hiding this comment

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

The redundancy of putting these two fields on rental to mirror the fields on video and customer introduces the risk that a bug could get introduced to cause them to go out of sync. If they did go out of sync, how should the system respond to that? Which number should it trust?
Because of that, it's generally best practice not to have redundant values intended to track the same information.

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