From 8b445ba28c9021ad6afbba224d2036bead6cb023 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Mon, 9 May 2022 02:47:28 -0700 Subject: [PATCH] Updated example [skip ci] --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a79faca..3303f40 100644 --- a/README.md +++ b/README.md @@ -1630,16 +1630,18 @@ Create a job to update the column and reindex records with new conversions. class ReindexConversionsJob < ApplicationJob def perform(class_name, since) # get records that have a recent conversion - recently_converted_ids = - Searchjoy::Search.where(convertable_type: class_name).where(converted_at: since..) + recently_converted_ids = Searchjoy::Search + .where(convertable_type: class_name).where(converted_at: since..) .order(:convertable_id).distinct.pluck(:convertable_id) # split into groups recently_converted_ids.in_groups_of(1000, false) do |ids| # fetch conversions - conversions = - Searchjoy::Search.where(convertable_id: ids, convertable_type: class_name).where.not(user_id: nil) - .group(:convertable_id, :query).distinct.count(:user_id) + conversions = Searchjoy::Search + .where(convertable_id: ids, convertable_type: class_name) + .where.not(user_id: nil) + .group(:convertable_id, :query) + .distinct.count(:user_id) # group conversions by record conversions_by_record = {} -- libgit2 0.21.0