Permalink
Browse files

[promo] Clean up code in order decorator from #1526

  • Loading branch information...
1 parent dab7e8d commit 26c80e7780121f47e1c1de165efa0f51e0a34767 @radar radar committed May 21, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 promo/app/models/spree/order_decorator.rb
@@ -18,7 +18,12 @@ def update_adjustments_with_promotion_limiting
update_adjustments_without_promotion_limiting
return if adjustments.promotion.eligible.none?
most_valuable_adjustment = adjustments.promotion.eligible.max{|a,b| a.amount.abs <=> b.amount.abs}
- ( adjustments.promotion.eligible - [most_valuable_adjustment] ).each{|adjustment| adjustment.update_attribute_without_callbacks(:eligible, false) unless adjustment.originator.calculator.is_a? Spree::Calculator::PerItem }
+ current_adjustments = (adjustments.promotion.eligible - [most_valuable_adjustment])
+ current_adjustments.each do |adjustment|
+ unless adjustment.originator.calculator.is_a?(Spree::Calculator::PerItem)
+ adjustment.update_attribute_without_callbacks(:eligible, false)
+ end
+ end
end
alias_method_chain :update_adjustments, :promotion_limiting
end

0 comments on commit 26c80e7

Please sign in to comment.