Follow-up - #1161 - Zendesk import fails for deleted tickets.

This commit is contained in:
Denny Bresch 2019-08-08 10:15:39 +02:00 committed by Thorsten Eckel
parent 371a4638ec
commit f1f93b773e
3 changed files with 30 additions and 1 deletions

View file

@ -6,6 +6,7 @@ class Sequencer
def self.sequence def self.sequence
[ [
'Import::Zendesk::Ticket::Skip::Deleted',
'Import::Zendesk::Ticket::UserID', 'Import::Zendesk::Ticket::UserID',
'Import::Zendesk::Ticket::OwnerID', 'Import::Zendesk::Ticket::OwnerID',
'Import::Zendesk::Ticket::GroupID', 'Import::Zendesk::Ticket::GroupID',

View file

@ -6,7 +6,12 @@ class Sequencer
class SubObject < Sequencer::Unit::Base class SubObject < Sequencer::Unit::Base
include ::Sequencer::Unit::Import::Zendesk::SubSequence::Base include ::Sequencer::Unit::Import::Zendesk::SubSequence::Base
uses :resource, :instance, :user_id, :model_class uses :resource, :instance, :user_id, :model_class, :action
def self.inherited(subclass)
subclass.prepend(::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action)
subclass.skip_action(:skipped, :failed)
end
def process def process
resource_iteration do |sub_resource| resource_iteration do |sub_resource|

View file

@ -0,0 +1,23 @@
class Sequencer
class Unit
module Import
module Zendesk
module Ticket
module Skip
class Deleted < Sequencer::Unit::Base
uses :resource
provides :action
def process
return if resource.status != 'deleted'
state.provide(:action, :skipped)
end
end
end
end
end
end
end
end