Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queues - Erica Case, Hyunji Kim - VideoStoreAPI #23

Open
wants to merge 43 commits into
base: master
Choose a base branch
from

Conversation

ricecakemonster
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. the seed data requires two main models : Customer and Movie. a customer has many movies and a movie has many customers. Since it's many to many relationship, we needed another model, Rental, that works between Customer and Movie models.
List all the completed endpoints of your application. '/zomg', 'customers', 'movies', 'movies/:title', 'rentals/:title/check-out', 'rentals/:title/check-in', 'rentals/overdue'
Describe a set of positive and negative test cases you implemented for a model. Rental/ validation test => positive test: "creates a rental with a movie and a customer", negative test: "doesn't create a rental without a movie"
Describe a set of positive and negative test cases you implemented for a controller. movies#show => positive test: "returns a movie with exactly the required fields", negative test: "returns a 404 for a non-existant movie and gives detailed error message"
How does your API respond when bad data is sent to it? it responds with error messages.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. Customer/movies_checked_out_count method : We didn't need to make a movies_check_out_count column since we can calculate it dynamically with the data we have. The reason why we kept movies_checked_out_count in the model is to keep the controller clean and to make it asccessible from rails console.
Do you have any recommendations on how we could improve this project for the next cohort? More project time will be nice.
Link to Trello https://trello.com/invite/b/KbGb2FKn/38ced58166ecf63a15e2acf2468e6a24/videostoreapi
Link to ERD https://www.lucidchart.com/invitations/accept/6a089e9d-842b-4f00-8834-b42c4a8582cd

@PilgrimMemoirs
Copy link

Video Store

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Well Done
Comprehension questions Well Done
General
Business Logic in Models Well Done - Nice use of utilizing AR relationships
All 3 required endpoints return expected JSON data Well Done
Requests respond with appropriate HTTP Status Code Well Done
Errors are reported Well Done
Testing
Passes all Smoke Tests Well Done
Model Tests - all relations, validations, and custom functions test positive & negative cases Well Done - when checking for negative cases on validation, nice checking of the error messages with the movies model. Would like to see that applied to the Customers as well. It 's a good idea to sync up with team members on your coding styles so that it's consistent. That includes even the order the describes are listed, like having the validations before the relationships.
Controller Tests - URI parameters and data in the request body have positive & negative cases Well Done
Optionals
POST routes use URI parameter and request body to add a new record to the database Well Done
GET /customers shows how many movies are checked out by a customer Well Done
GET /movies/:title shows updated inventory Well Done
Overall
Great work accomplishing all the required tasks (and the optional post) to expectations! A suggestion would be to have a set coding style for the project. That's something that can be discussed before the project, before starting a feature or while merging.

Copy link

@Erin007 Erin007 left a comment

Choose a reason for hiding this comment

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

Hi, I'm Erin from C6 just helping out my pals who were assigned to review this but are swamped right now. You're probably swamped too with internship interviews (good luck!); but I wanted you to have feedback to look over whenever you're ready. You're also probably going to look at this and say '24 comments - wtf?!' Don't worry. They're just little things, things I've been given feedback on in the past, things to consider more broadly as you head into industry, and a few caught typos. Overall, ya'll should be super proud of the huge amount of work you put it. You crushed it! If you have any questions, please let me know - happy to chat more about comments, etc.

1. Then Select `Add`
![add button](images/add-btn.png)
1. Lastly add a key `url` and value `http://localhost:3000`
![Key & Value](images/key-value.png)
1. Click the blue `Run` button. This will launch the collection runner.
1. In the collection runner, scroll down in the center pane and click the blue `Start Test` button

Copy link

Choose a reason for hiding this comment

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

⭐️ for including a README! Documentation - especially good documentation - is so often overlooked and is super useful!

if rentals == []
render json: {errors: "Cannot Find the Rental Records"}, status: :not_found
else
not_returned = rentals.where(returned_date: nil)
Copy link

@Erin007 Erin007 Jun 8, 2017

Choose a reason for hiding this comment

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

nit: I've gotten feedback in industry that it is often more readable to use a positive name for clarity (e.g. checked_out rather than not_returned or signed_out rather than not_signed_in). Could just a be personal preference, though!

if not_returned == []
render json: {errors: "All movies are already returned"}, status: :not_found
else
#if the customer has checked out mutiple copies of the same movie, check in the movie with the earliest checkout date first.
Copy link

Choose a reason for hiding this comment

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

interesting edge case here - good catch!

@@ -0,0 +1,39 @@
class RentalsController < ApplicationController
def zomg
Copy link

Choose a reason for hiding this comment

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

makes sense here, but in the future when you're awesome devs working in big codebases, I would expect checks like this to be removed in production code. Same idea for the debuggers in your movie model.

end

def overdue
if Rental.all.empty?
Copy link

Choose a reason for hiding this comment

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

Not sure if you need .all here? Also you might consider syncing on consistency of .empty? or == [] or .nil? Each is used throughout your code.

must_respond_with :ok
end

it "returns 404 if overdue rentals don't exit" do
Copy link

Choose a reason for hiding this comment

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

typo - exist
Now that I think about it, 404 might not be the response you want here. 404 means that the information you were looking for was not found - there's some kind of problem. What you want to be saying here is that the information/category was found, but that there are zero things in the category. Might make more sense to give the user some kind of message: "There are no overdue rentals at this time".


tusk:
title: Tusk
overview: Walrus Horror Film
Copy link

Choose a reason for hiding this comment

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

😱

it "can have many movies" do
customer = customers(:one)
customer.movies.count.must_equal 3
end
Copy link

Choose a reason for hiding this comment

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

This seems strange to me. What does it mean to "have a movie" if not to rent it?

movie.valid?.must_equal false
movie.errors.messages.must_include :title
end

Copy link

Choose a reason for hiding this comment

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

You test > and < 0, what if it is 0?

movie.available_inventory.must_equal 0
end

it "does not subtract movies that have been checked in" do
Copy link

Choose a reason for hiding this comment

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

test for checking in a movie? should increase inventory?

@Erin007
Copy link

Erin007 commented Jun 9, 2017

cc: @jmojennifer @RedSquirrelious

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.

6 participants