2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2018-07-23 08:24:23 +00:00
|
|
|
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
|