Commit 8d9025ff205f722b4bce094118b0a276c510d5be

Authored by Andrew Kane
1 parent b993a4eb

Updated example [skip ci]

Showing 1 changed file with 5 additions and 5 deletions   Show diff stats
README.md
... ... @@ -1630,16 +1630,16 @@ Create a job to update the column and reindex records with new conversions.
1630 1630 class ReindexConversionsJob < ApplicationJob
1631 1631 def perform(class_name, since)
1632 1632 # get records that have a recent conversion
1633   - recently_converted_ids = Searchjoy::Search
1634   - .where(convertable_type: class_name).where(converted_at: since..)
  1633 + recently_converted_ids =
  1634 + Searchjoy::Search.where(convertable_type: class_name).where(converted_at: since..)
1635 1635 .order(:convertable_id).distinct.pluck(:convertable_id)
1636 1636  
1637 1637 # split into groups
1638 1638 recently_converted_ids.in_groups_of(1000, false) do |ids|
1639 1639 # fetch conversions
1640   - conversions = Searchjoy::Search
1641   - .where(convertable_id: ids, convertable_type: class_name).where.not(user_id: nil)
1642   - .group(:convertable_id, :query).distinct.count(:user_id)
  1640 + conversions =
  1641 + Searchjoy::Search.where(convertable_id: ids, convertable_type: class_name)
  1642 + .where.not(user_id: nil).group(:convertable_id, :query).distinct.count(:user_id)
1643 1643  
1644 1644 # group conversions by record
1645 1645 conversions_by_record = {}
... ...