2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-10-20 09:43:35 +00:00
|
|
|
|
|
|
|
class Sequencer
|
|
|
|
class Unit
|
|
|
|
module Import
|
|
|
|
module Kayako
|
|
|
|
module TimeEntry
|
|
|
|
class Mapping < Sequencer::Unit::Base
|
|
|
|
include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
|
|
|
|
|
|
|
|
uses :resource, :id_map, :created_by_id
|
|
|
|
provides :action
|
|
|
|
|
|
|
|
def process
|
|
|
|
provide_mapped do
|
|
|
|
{
|
|
|
|
time_unit: time_unit,
|
|
|
|
ticket_id: ticket_id,
|
|
|
|
created_by_id: created_by_id,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def time_unit
|
|
|
|
resource['time_spent'].to_i / 60
|
|
|
|
end
|
|
|
|
|
|
|
|
def ticket_id
|
|
|
|
id_map['Ticket'][resource['case']['id']]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|