mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix line item cache migration to work across orders in the staging servers.
This commit is contained in:
@@ -2,11 +2,17 @@ class UpdateLineItemCaching < ActiveRecord::Migration
|
||||
|
||||
class SpreeLineItem < ActiveRecord::Base
|
||||
belongs_to :shipping_method, class_name: 'Spree::ShippingMethod'
|
||||
belongs_to :variant, :class_name => "Spree::Variant"
|
||||
|
||||
def itemwise_shipping_cost
|
||||
order = OpenStruct.new :line_items => [self]
|
||||
shipping_method.compute_amount(order)
|
||||
end
|
||||
|
||||
def amount
|
||||
price * quantity
|
||||
end
|
||||
alias total amount
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user