Skip to content

Commit

Permalink
Revert "Optimize Spree::InventoryUnit#quantity_no_less_than_shipped"
Browse files Browse the repository at this point in the history
This reverts commit df0740c.

Conflicts:

	core/app/models/spree/line_item.rb
  • Loading branch information
radar committed Aug 28, 2012
1 parent 1dd0227 commit 5fad696
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/app/models/spree/line_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def stock_availability
end

def quantity_no_less_than_shipped
already_shipped = order.shipments.reduce(0) { |acc,s| acc + s.inventory_units.where(:variant_id => variant.id).count }
already_shipped = order.shipments.reduce(0) { |acc,s| acc + s.inventory_units.select { |i| i.variant == variant }.count }
unless quantity >= already_shipped
errors.add(:quantity, I18n.t('validation.cannot_be_less_than_shipped_units'))
end
Expand Down

0 comments on commit 5fad696

Please sign in to comment.