Skip to content

Conversation

@unkcodesquick
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 knew we had to have a join table for the movies and customers to be connected. Instead of just using a join table we created another model Rentals that would act as a join table and store additional information about the rental such as due_date.
What would be the Big-O time complexity of your /customers & /movies endpoints? What does the time complexity depend on? Explain your reasoning. The time complexity of our customers and movies endpoints is linear/ O(n) because of the sort method. The time complexity depends on the number of customers or movies in the database.
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) -- need to find the rental and match it with the check in request. Worst case you need to loop through all of them.
Describe a set of positive and negative test cases you implemented for a model. We tested the creation of our models with valid and valid data.
Describe a set of positive and negative test cases you implemented for a controller. We used incorrect sorting parameters and correct sorting parameters to see how the controller dealt with it.
How does your API respond when bad data is sent to it? It will render json message and status code of bad request, when bad data is sent.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. The available_inventory is a model method for the movie model. It is wrapped in a method instead of a column because it's dependent on movie rentals and always changing.
Do you have any recommendations on how we could improve this project for the next cohort? Waves 1-3 were pretty basic and straightforward, the comment above the optionals is a little misleading and made us question if we were doing it right. It would have been nice to cover in class that json could return values from methods and isn't exclusively calling information from columns in the DB.
Link to Trello https://trello.com/b/tBrfIUgg/videostoreapi-amanda-danielle
Link to ERD On Trello
Summary This was an enjoyable pairing experience and we liked having a flexible schedule this week.

unkcodesquick and others added 30 commits November 5, 2018 10:41
@CheezItMan
Copy link

Video Store

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Good commit messages and good number of commits.
Comprehension questions Check, You tested your controllers with valid and valid data? (I assume you intended invalid). I'm glad you enjoyed the flexible schedule
General
Business Logic in Models Check,
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 No test for the customer's movies_checked_out_count method, minor issue. Also no test for custom methods in the Movie or Rental models.
Controller Tests - URI parameters and data in the request body have positive & negative cases I like the positive and negative tests here!
Overall You did well, I would avoid class variables in your controllers. In general it's a bad habit. You also should always test your custom model methods. You did however hit all the learning goals, well done.

belongs_to :movie
belongs_to :customer

before_create :set_default_to_checkin_date

Choose a reason for hiding this comment

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

Good find!

@@ -0,0 +1,25 @@
class ApplicationController < ActionController::API

def sort(list, params, sort_params, fields, method: nil)

Choose a reason for hiding this comment

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

Good use of the ApplicationController. Should it be private?

class CustomersController < ApplicationController
@@fields = [:id, :name, :register, :postal_code, :phone, :registered_at]
@@method = :movies_checked_out_count
@@sort_params = ['name', 'registered_at', 'postal_code']

Choose a reason for hiding this comment

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

In general don't make class variables in Rails controllers. It's a bad practice. Constants are fine

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