lib/eco/api/session/batch_job.rb in eco-helpers-0.6.11 vs lib/eco/api/session/batch_job.rb in eco-helpers-0.6.12
- old
+ new
@@ -53,11 +53,11 @@
def processed_queue
@queue.map do |entry|
callback = @callbacks[entry]
e = entry
e = callback.call(entry) if callback
- e = nil if as_update(e).empty?
+ e = nil if as_update(e).empty? && @type!=:delete
e
end.compact
end
def launch(simulate: false)
@@ -97,12 +97,16 @@
private
def as_update(update)
hash = update if update.is_a?(Hash)
- hash = update.as_update if update.is_a?(Ecoportal::API::V1::Person)
- fields = hash&.dig('details', 'fields')
- fields&.map! { |fld| fld&.slice("id", "alt_id", "value") }
+ if @type == :delete
+ hash = update.as_json.slice("id", "external_id")
+ else
+ hash = update.as_update if update.is_a?(Ecoportal::API::V1::Person)
+ fields = hash&.dig('details', 'fields')
+ fields&.map! { |fld| fld&.slice("id", "alt_id", "value") }
+ end
hash || {}
end
def sets_title
"#{@sets.map {|s| s.to_s}.join(", ")}"