Sha256: 24d31fd07aa9a63595f22f899f1aa2266218771993cfc7b155cfc605846fe82e

Contents?: true

Size: 1.23 KB

Versions: 27

Compression:

Stored size: 1.23 KB

Contents

module Eco
  module API
    class MicroCases
      # Sets all the core details, but the supervisor.
      # @note `supervisor_id` requires a special treatment, and therefore is always excluded.
      # @param entry [PersonEntry] the input entry with the data we should set on person.
      # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
      # @param people [Eco::API::Organization::People] target existing _People_ of the current update.
      # @param supers_job [Eco::API::Session::Batch::Job] the job that will run the supers .
      # @param options [Hash] the options.
      def set_core_with_supervisor(entry, person, people, supers_job, options)
        return if options.dig(:exclude, :core) && !person.new?

        micro.set_core(entry, person, options)

        return unless entry.supervisor_id?

        micro.set_supervisor(
          person,
          entry.supervisor_id,
          people,
          options
        ) do |unknown_id|
          # delay setting supervisor if does not exit
          supers_job.add(person) do |pers|
            micro.set_supervisor(pers, unknown_id, people, options)
          end
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
eco-helpers-3.0.21 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.20 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.19 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.18 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.17 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.16 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.15 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.14 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.13 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.12 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.11 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.10 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.9 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.8 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.7 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.6 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.5 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.4 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.3 lib/eco/api/microcases/set_core_with_supervisor.rb
eco-helpers-3.0.2 lib/eco/api/microcases/set_core_with_supervisor.rb