Update DB schema to store updatable weight on items sold

This commit is contained in:
Lynne Davis
2015-04-04 17:06:26 +01:00
parent e8c8d8885c
commit f7ade48e86
3 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
Spree::Api::LineItemsController.class_eval do
after_filter :apply_enterprise_fees, :only => :update
def apply_enterprise_fees
authorize! :read, order
order.update_distribution_charge!
end
end
#when we update a line item the .update_distribution_charge! is called
# order.should_receive .update_distribution_charge!
# check fails when absent
# in order model check that .update_distribution_charge! is properly tested.
# think through use cases - existing completed order
# currently likely just used to complete orders so add test case that works on a completed order

View File

@@ -0,0 +1,5 @@
class AddWeightToLineItems < ActiveRecord::Migration
def change
add_column :spree_line_items, :unit_value, :decimal, :precision => 8, :scale => 2
end
end

View File

@@ -549,6 +549,7 @@ ActiveRecord::Schema.define(:version => 20150424025907) do
t.string "currency"
t.decimal "distribution_fee", :precision => 10, :scale => 2
t.string "shipping_method_name"
t.decimal "unit_value", :precision => 8, :scale => 2
end
add_index "spree_line_items", ["order_id"], :name => "index_line_items_on_order_id"