Skip to content

Commit

Permalink
Merge pull request #4285 from mamhoff/faster-create-item-adjustments
Browse files Browse the repository at this point in the history
Promotion Rule CreateItemAdjustments: Use in-memory objects
  • Loading branch information
waiting-for-dev authored Mar 7, 2022
2 parents 79d8a0d + b274da9 commit 592bd68
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,8 @@ def ensure_action_has_calculator
end

def line_items_to_adjust(promotion, order)
excluded_ids = adjustments.
where(adjustable_id: order.line_items.pluck(:id), adjustable_type: 'Spree::LineItem').
pluck(:adjustable_id).
to_set

order.line_items.select do |line_item|
!excluded_ids.include?(line_item.id) &&
line_item.adjustments.none? { |adjustment| adjustment.source == self } &&
promotion.line_item_actionable?(order, line_item)
end
end
Expand Down

0 comments on commit 592bd68

Please sign in to comment.