Fixed bug order.profit calculation.
Order.profit will also be saved, when order is closed.
This commit is contained in:
parent
843e4a7233
commit
da08365816
32 changed files with 408 additions and 34 deletions
13
db/migrate/20090317175355_add_profit_to_orders.rb
Normal file
13
db/migrate/20090317175355_add_profit_to_orders.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class AddProfitToOrders < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :orders, :foodcoop_result, :decimal, :precision => 8, :scale => 2
|
||||
|
||||
Order.closed.each do |order|
|
||||
order.update_attribute(:foodcoop_result, order.profit)
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :orders, :foodcoop_result
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue