diff --git a/app/models/spree/inventory_unit_decorator.rb b/app/models/spree/inventory_unit_decorator.rb index 5f1f2c22..aacca46d 100644 --- a/app/models/spree/inventory_unit_decorator.rb +++ b/app/models/spree/inventory_unit_decorator.rb @@ -3,7 +3,7 @@ module Spree def percentage_of_line_item product = line_item.product if product.assembly? - total_value = line_item.quantity_by_variant.map { |part, quantity| part.price * quantity }.sum + total_value = line_item.quantity_by_variant.sum { |part, quantity| part.price * quantity } variant.price / total_value else 1 / BigDecimal.new(line_item.quantity)