Class: CatalogItemUrlCheckerWorker
- Inherits:
-
Object
- Object
- CatalogItemUrlCheckerWorker
- Includes:
- Sidekiq::Job
- Defined in:
- app/workers/catalog_item_url_checker_worker.rb
Instance Method Summary collapse
Instance Method Details
#perform ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/workers/catalog_item_url_checker_worker.rb', line 7 def perform # missing_urls = [] # invalid_urls = [] # exclude_patterns = ['homedepot.','build.com', 'costco', 'lowes'] # catalog_items = CatalogItem.where(state: 'active').where.not(url: [nil, '']).where(url_valid: false) # exclude_patterns.each do |term| # catalog_items = catalog_items.where.not(CatalogItem[:url].matches("%#{term}%")) # end # invalid_urls = catalog_items.to_a # missing_urls = CatalogItem.where(state: 'active'). # joins(store_item: { item: :primary_product_line }). # towel_warmers.hidden_from_catalog.where(url: [nil, '']). # where(ProductLine[:slug_ltree].matches("towel_warmer.premier%").or(ProductLine[:slug_ltree].matches("towel_warmer.elevate%"))). # where.not(catalog_id: Catalog.main_catalog_ids).to_a # InternalMailer.public_link_checker_catalog_item(missing_urls, invalid_urls).deliver_now if missing_urls.present? || invalid_urls.present? # { missing_urls: missing_urls, invalid_urls: invalid_urls } end |