lib/eco/api/microcases/with_each_starter.rb in eco-helpers-2.7.24 vs lib/eco/api/microcases/with_each_starter.rb in eco-helpers-2.7.25

- old
+ new

@@ -14,20 +14,24 @@ # @yieldparam person [Ecoportal::API::V1::Person] the **new** person. # @return [Eco::API::Organization::People] the starters. def with_each_starter(entries, people, options, log_present: false, append_created: true) starters = [] micro.with_each(entries, people, options, append_created: append_created) do |entry, person| - if !person.new? + unless person.new? if log_present - session.logger.error("This person (id: '#{person.id}') already exists: #{entry.to_s(:identify)}") + log(:error) { + "This person (id: '#{person.id}') already exists: #{entry.to_s(:identify)}" + } end + next end + starters << person yield(entry, person) if block_given? end + people.newFrom starters end - end end end