Skip to content

Instantly share code, notes, and snippets.

@JoshCheek
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshCheek/8134d66f586ba83a6dbc to your computer and use it in GitHub Desktop.
Save JoshCheek/8134d66f586ba83a6dbc to your computer and use it in GitHub Desktop.
Sales Engine intro for SE2

Sales Engine

Due

3pm on Tuesday, May 12th

Pairs

  • Ricky & Rob
  • Michael & Dave
  • Margarett & Eugene
  • Lev & Vanessa

What is it?

  • Explain what the concept is (not how to divide up the work)

  • http://tutorials.jumpstartlab.com/projects/sales_engine.html

  • http://tutorials.jumpstartlab.com/images/sales_engine.png

  • Have them

    • Read the assignment
    • Re-read the assignment and make notes/highlights
    • Discuss each person's schedule constraints
    • Make a plan for what hours/days you're going to work
    • Discuss your personal learning goals and what you're looking to get better at
    • Setup your repo on both machines
    • create some waffle tasks (or github issues)
    • look, y'all, don't go planning the whole thing out today, you'll be wrong
  • Rachel: "business logic is worth paying attn to"

  • Example of how I should be able to use your code:

    engine = SalesEngine.new('csvs')
    engine.startup
    
    # Customers
    repo = engine.customer_repository
    repo.class # => CustomerRepository
    
    customer = repo.find_by_first_name("Mariah")
    customer.class # => Customer
    customer.name  # => "Mariah"
    customer.id    # => 3
    
    
    customer = repo.find_by_id(3)
    customer.name # => "Mariah"
    
    # Invoices
    repo = engine.invoice_repository
    repo # => InvoiceRepository
    
    invoice = repo.find_by_id(10)
    invoice.class       # => Invoice
    invoice.merchant_id # => 86
    invoice.customer_id # => 3
    
    customer = invoice.customer
    customer.class # => Customer
    customer.name  # => "Mariah"
    
    customer.invoices.class       # => Array (or InvoiceRepository)
    customer.invoices.first.class # => Invoice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment