update_cti_logs_by_caller_job.rb 398 B

12345678910111213
  1. class UpdateCtiLogsByCallerJob < ApplicationJob
  2. def perform(phone, limit: 60, offset: 0)
  3. preferences = Cti::CallerId.get_comment_preferences(phone, 'from')&.last
  4. Cti::Log.where(from: phone, direction: 'in')
  5. .order(created_at: :desc)
  6. .limit(limit)
  7. .offset(offset)
  8. .each do |log|
  9. log.update(preferences: preferences)
  10. end
  11. end
  12. end