Skip to content
Browse files

[promo] Check for calculator on adjustment.originator in update_adjus…

…tments_with_promotion_listing before checking its type

Related up to #1526
  • Loading branch information...
1 parent 26c80e7 commit fe71cd0d3af77397d5b34c7f7222c50f978841c0 @radar radar committed
Showing with 2 additions and 1 deletion.
  1. +2 −1 promo/app/models/spree/order_decorator.rb
View
3 promo/app/models/spree/order_decorator.rb
@@ -20,7 +20,8 @@ def update_adjustments_with_promotion_limiting
most_valuable_adjustment = adjustments.promotion.eligible.max{|a,b| a.amount.abs <=> b.amount.abs}
current_adjustments = (adjustments.promotion.eligible - [most_valuable_adjustment])
current_adjustments.each do |adjustment|
- unless adjustment.originator.calculator.is_a?(Spree::Calculator::PerItem)
+ calculator = adjustment.originator.try(:calculator)
+ if calculator && !calculator.is_a?(Spree::Calculator::PerItem)
adjustment.update_attribute_without_callbacks(:eligible, false)
end
end

0 comments on commit fe71cd0

Please sign in to comment.
Something went wrong with that request. Please try again.