trabajo-afectivo/app/jobs/update_cti_logs_by_caller_job.rb

16 lines
475 B
Ruby
Raw Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
class UpdateCtiLogsByCallerJob < ApplicationJob
def perform(phone, limit: 60, offset: 0)
preferences = Cti::CallerId.get_comment_preferences(phone, 'from')&.last
Cti::Log.where(from: phone, direction: 'in')
.order(created_at: :desc)
.limit(limit)
.offset(offset)
.each do |log|
log.update(preferences: preferences)
end
end
end