Class: OnlineMigrations::BackgroundMigrations::BackfillSiteMapRecommendations
- Inherits:
-
OnlineMigrations::BackgroundMigration
- Object
- OnlineMigrations::BackgroundMigration
- OnlineMigrations::BackgroundMigrations::BackfillSiteMapRecommendations
- Defined in:
- lib/online_migrations/background_migrations/backfill_site_map_recommendations.rb
Overview
Backfills SiteMapRecommendation records from existing seo_report JSONB data.
Runs Seo::RecommendationExtractorService for each SiteMap that has a report
but no recommendations yet.
Enqueued by: 20260314053655_create_site_map_recommendations.rb
Delegated Instance Attributes collapse
-
#count ⇒ Object
Alias for Relation#count.
Instance Method Summary collapse
Instance Method Details
#count ⇒ Object
Alias for Relation#count
27 |
# File 'lib/online_migrations/background_migrations/backfill_site_map_recommendations.rb', line 27 delegate :count, to: :relation |
#process_batch(site_maps) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/online_migrations/background_migrations/backfill_site_map_recommendations.rb', line 19 def process_batch(site_maps) site_maps.each do |site_map| Seo::RecommendationExtractorService.new(site_map: site_map).process rescue StandardError => e Rails.logger.warn "[BackfillSiteMapRecommendations] Error for SiteMap #{site_map.id}: #{e.}" end end |
#relation ⇒ Object
12 13 14 15 16 17 |
# File 'lib/online_migrations/background_migrations/backfill_site_map_recommendations.rb', line 12 def relation SiteMap .where.not(seo_report: nil) .where.not(seo_report: {}) .where.not(id: SiteMapRecommendation.select(:site_map_id)) end |