priority_id.rb 550 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Zendesk::Ticket::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, mapping[nil])
  10. end
  11. def mapping
  12. {
  13. 'low' => '1 low',
  14. nil => '2 normal',
  15. 'normal' => '2 normal',
  16. 'high' => '3 high',
  17. 'urgent' => '3 high',
  18. }.freeze
  19. end
  20. end