4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/workers/customer_coupons_booster_worker.rb', line 4
def perform(customer_ids = [])
tier2_coupons = Coupon::Tier2ProgramPricing.where(code: ['PP-SILVER-LEVEL','PP-GOLD-LEVEL','PP-PLATINUM-LEVEL','PP-TITANIUM-LEVEL']).pluck(:id)
customers = Customer.joins(:customer_record)
.where(tier2_program_pricing_id: tier2_coupons)
.where('(customer_records.a12net_rev > ? or customer_records.a12net_rev between ? and ? or customer_records.a12net_rev between ? and ?)',
Customer::PricingProgramAssigner::TITANIUM_LEVEL_MIN_THRESHOLD,
Customer::PricingProgramAssigner::PLATINUM_LEVEL_MIN_THRESHOLD,
Customer::PricingProgramAssigner::PLATINUM_LEVEL_MAX_THRESHOLD,
Customer::PricingProgramAssigner::GOLD_LEVEL_MIN_THRESHOLD,
Customer::PricingProgramAssigner::GOLD_LEVEL_MAX_THRESHOLD)
customers.each do |customer|
Customer::PricingProgramAssigner.new(customer_id: customer.id).coupon_booster
end
end
|