Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Keeps track of inter-office tabs

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config Added the users route and simple view. June 18, 2010
Octocat-spinner-32 db
Octocat-spinner-32 doc
Octocat-spinner-32 lib
Octocat-spinner-32 public
Octocat-spinner-32 script
Octocat-spinner-32 test
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 config.ru
README
h1. Tab

Keep track of office tabs.

h2. Models

Users: id, name

Orders: id, LineItems
LineItems: id, order_id, name, cost, quantity

Transactions (Debits, Credits): id, type, line_item_id, user_id, amount, balance

h2. Scenarios

* Bob orders a pizza. Bob, Joe, and Clint split the cost.

o = Order.create
li = LineItem.create( :order => o,
                      :name => "Lg Antico Pizza",
                      :cost => 20_00, :quantity => 1 )

# Bob has paid $20 into the system, giving him credit
Credit.create(:line_item => li,
              :user => bob,
              :amount => 20_00)

# Each person owes $20 / 3, including Bob (he did eat, right?)
individual_cost = li.cost / users.size # $20.00 / 3
users.each do |u|
  Debit.create( :line_item => li,
                :user => u,
                :amount => individual_cost)
end
Something went wrong with that request. Please try again.