Sha256: 1b32f39e61b9d8f39e40168068d0f42a866f1c9736fb0731a40391aa5719337d

Contents?: true

Size: 553 Bytes

Versions: 1

Compression:

Stored size: 553 Bytes

Contents

module Gemgento
  class ApplyPriceRule
    include Sidekiq::Worker

    def perform(price_rule_id)
      price_rule = PriceRule.find(price_rule_id)
      touched = false

      Product.active.each do |product|
        Store.all.each do |store|
          break if touched
          next unless price_rule.stores.include?(store)

          if PriceRule.meets_condition?(price_rule.conditions, product, store)
            product.set_cache_expires_at
            touched = true
          end
        end

        touched = false
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gemgento-2.8.0 app/workers/gemgento/apply_price_rule.rb