Skip to content

mtodd/tab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Keeps track of inter-office tabs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages