update_cti_logs_by_caller_job.rb 477 B

123456789101112131415
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class UpdateCtiLogsByCallerJob < ApplicationJob
  3. def perform(phone, limit: 60, offset: 0)
  4. preferences = Cti::CallerId.get_comment_preferences(phone, 'from')&.last
  5. Cti::Log.where(from: phone, direction: 'in')
  6. .reorder(created_at: :desc)
  7. .limit(limit)
  8. .offset(offset)
  9. .each do |log|
  10. log.update(preferences: preferences)
  11. end
  12. end
  13. end