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 5d7659aa3c
commit bf44a1c862
3 changed files with 24 additions and 1 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

@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150225232938) do
ActiveRecord::Schema.define(:version => 20150305004846) do
create_table "adjustment_metadata", :force => true do |t|
t.integer "adjustment_id"
@@ -532,6 +532,7 @@ ActiveRecord::Schema.define(:version => 20150225232938) 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"