Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace :reindex_doctor_locations do
- desc "Reindex doctor profiles in batches"
- task :execute, [:offset, :limit] => :environment do |task, args|
- Rails.application.eager_load!
- DoctorLocation.where(doctor_profile: DoctorProfile.left_joins(:doctor_source)
- .where("doctor_sources.url IS NULL OR (doctor_sources.url IS NOT NULL AND doctor_sources.url != 'npi')"))
- .order(:id)
- .offset(args.offset.to_i)
- .limit(args.limit.to_i).reindex!
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement