lib/eco/api/microcases/with_each_starter.rb in eco-helpers-2.0.25 vs lib/eco/api/microcases/with_each_starter.rb in eco-helpers-2.0.26
- old
+ new
@@ -6,16 +6,17 @@
# - it also links to `person.entry` the input data `entry`.
# @param entries [Eco::API::Common::People::Entries] the input entries with the data.
# @param people [Eco::API::Organization::People] target existing _People_ of the current update.
# @param options [Hash] the options.
# @param log_present [Boolean] log error message if an `entry` has match in `people`.
+ # @param append_created [Boolean] whether or not a new person will be added to the `people` object.
# @yield [entry, person] gives each **new** `person` of `entries` that is not present in `people`.
# @yieldparam entry [PersonEntry] the input entry with the data we should set on person.
# @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)
+ def with_each_starter(entries, people, options, log_present: false, append_created: true)
starters = []
- micro.with_each(entries, people, options) do |entry, person|
+ micro.with_each(entries, people, options, append_created: append_created) do |entry, person|
if !person.new?
if log_present
session.logger.error("This person (id: '#{person.id}') already exists: #{entry.to_s(:identify)}")
end
next