Class: Gemgento::ApplyPriceRule
- Inherits:
-
Object
- Object
- Gemgento::ApplyPriceRule
- Includes:
- Sidekiq::Worker
- Defined in:
- app/workers/gemgento/apply_price_rule.rb
Instance Method Summary collapse
Instance Method Details
#perform(price_rule_id) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/workers/gemgento/apply_price_rule.rb', line 5 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 |