Git Product home page Git Product logo

object-relations-assessment-final-web-051517's Introduction

Object Relations Assessment

For this assignment, we'll be building out Netflix! A viewer has left many ratings on movies, and a movie has been rated by many views.

As always, make sure to sketch out your domain and think about the single source of truth for your data.

Topics

  • Classes vs Instances
  • Variable Scope ( Class, Instance, Local )
  • Object Relationships
  • Arrays and Array Methods
  • Class Methods

Notes

Your goal is to build out all of the methods listed in the deliverables. Do your best to follow Ruby best practices. For example, use higher-level array methods such as map, select, and find when appropriate in place of each

We've provided you with a console that you can use to test your code. To enter a console session, run ruby tools/console.rb. You'll be able to test out the methods that you write here.

To Submit - once you've completed all the deliverables, please copy/paste your three class definitions into the solution.rb file. Please don't submit the lab until we give you the signal.

Deliverables

Build the following methods on the viewer class

  • Viewer.all
    • should return all of the viewers
  • Viewer.find_by_name(name)
    • given a string of a full name, returns the first customer whose full name matches
  • Viewer#create_rating
    • given a score and a movie, creates a new Rating and associates it with that viewer and that movie

Build out the following methods on the Rating class

  • Rating.all
    • returns all of the ratings
  • Rating#viewer
    • returns the viewer for that given rating
  • Rating#movie
    • returns the movie for that given rating

Build out the following methods on the movie class

  • Movie.all
    • returns an array of all movies
  • Movie.find_by_title(title)
    • given a string of movie title, returns the first movie that matches
  • Movie#ratings
    • returns an array of all ratings for that movie
  • Movie#viewers
    • should return all of the viewers who have left ratings for that movie.
  • Movie#average_rating
    • should return the average of all of the scores for the ratings of that particular movie.

object-relations-assessment-final-web-051517's People

Contributors

ipc103 avatar natgit8 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.