Skip to content

Conversation

@juliabouv
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. Because a customer and movie seeds were provided, we were fairly confident that each of these would be a model and need a controller. Because a rental should hold a customer and a movie (which customer checked out/in which movie), we felt that that should be some kind of “join table” or equivalent - it’s own model at the least.
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 those endpoints would be O(n) where n is the number of customers or movies. As the number of customers and movies increase in the database, it would take that much longer to return every customer and movie.
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(1) assuming that find_by is a direct look up in the database, as movie, customer, and rental all need to be found in order to edit the rental instance.
Describe a set of positive and negative test cases you implemented for a model. A positive test case implemented in the movie model was being able to instantiate a movie when all correct parameters are given. A negative test case was testing whether a movie could be created when the title was missing or if it wasn’t unique.
Describe a set of positive and negative test cases you implemented for a controller. The rental controller tests for the checkout action has the positive test case that it can create a new rental and responds with ok status, and the negative case that it responds with bad_request when request fails validation (no customer).
How does your API respond when bad data is sent to it? The API returns a 400 bad request and a hash containing the error messages of which data was bad.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. We do not currently have any custom model methods, but feel that if we added the optionals to adjust movie inventory and and customer information when creating and updating rentals, model methods would be necessary.
Do you have any recommendations on how we could improve this project for the next cohort? I think more explanation into Postman, what it is used for, and how smoke tests work would have been helpful.
Link to Trello We did not feel it was necessary to create a Trello because there were only two of us. We communicated effectively in person and via slack, and used branches to keep track of our project.
Link to ERD https://docs.google.com/document/d/1vptSCs8aHkQCYVfWgzWLckc4Ts2Ne7gdWJVP3Ddo1TU/edit?usp=sharing
Summary Yay, this was so fun to mix both classes for a pair project!

@CheezItMan
Copy link

Video Store

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Good number of commits, granular commits, and good commit messages, both team members contributing
Comprehension questions Check
General
Business Logic in Models NONE
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 This is really skimpy testing
Controller Tests - URI parameters and data in the request body have positive & negative cases Mostly ok, see my inline comments
Overall Not bad, you don't have any logic in the models and very minimal testing. That said it passes the smoke tests and does serve required JSON. So somethings could be better, but you have the essentials.

@@ -0,0 +1,52 @@
class RentalsController < ApplicationController
def checkout

Choose a reason for hiding this comment

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

Nothing to ensure that there are enough movies in the inventory to check it out?

end
end

def checkin

Choose a reason for hiding this comment

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

The check-in/out logic would make sense to put into a model method

Comment on lines +3 to +7
describe Customer do
# it "does a thing" do
# value(1+1).must_equal 2
# end
end

Choose a reason for hiding this comment

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

Missing tests

end

describe "relationships" do
it "can have many rentals" do

Choose a reason for hiding this comment

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

You might also add that it could have 0 rentals.

end
end

describe "validations" do

Choose a reason for hiding this comment

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

No more validations?

@@ -0,0 +1,19 @@
require "test_helper"

describe Rental do

Choose a reason for hiding this comment

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

No test that it's valid with a movie & customer?

@@ -0,0 +1,28 @@
require "test_helper"

describe CustomersController do

Choose a reason for hiding this comment

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

👍

expect(body.keys).must_include 'id'
end

it "responds with bad_request when request fails validation (no customer)" do

Choose a reason for hiding this comment

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

What about a test when the movie isn't available.

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