priority_id.rb 540 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Kayako::Case::PriorityId < Sequencer::Unit::Common::Provider::Named
  3. uses :resource
  4. private
  5. def priority_id
  6. ::Ticket::Priority.select(:id).find_by(name: local).id
  7. end
  8. def local
  9. mapping.fetch(resource['priority']&.fetch('level'), mapping[nil])
  10. end
  11. def mapping
  12. {
  13. 1 => '1 low',
  14. nil => '2 normal',
  15. 2 => '2 normal',
  16. 3 => '3 high',
  17. 4 => '3 high',
  18. }.freeze
  19. end
  20. end