Untitled
unknown
plain_text
a month ago
776 B
0
Indexable
Never
def coupons(include_upcoming: false, unscope_shop_status: false) return @coupons if @coupons.present? @coupons = @site_facade .shop_coupons_and_cross_coupons(@shop, include_upcoming: include_upcoming, unscope_shop_status: unscope_shop_status) .includes(:curator) .includes(:gift_card) filter_blocked_campaign_coupons if hide_coupons_from_sub_pages @coupons end def filter_blocked_campaign_coupons @coupons = @coupons.where.not(id: blocked_coupon_ids) if blocked_coupon_ids.present? end def blocked_coupon_ids return CampaignsCoupon.where(campaign_id: @sub_pages.pluck(:id)).pluck(:coupon_id) if sub_pages.present? @coupons.joins(campaigns_coupons: :campaign).where(campaign: { status: 'blocked' }).pluck(:id) end
Leave a Comment