Sha256: 9ec90676f9021af0d727d44ee61d4adcd38e8bf53e18ac05c971f53f55eb5ea4

Contents?: true

Size: 807 Bytes

Versions: 110

Compression:

Stored size: 807 Bytes

Contents

module Eco
  module API
    class MicroCases
      # Helper to preserve the original `default_tag`.
      # @note
      #   1. It only works if the original value of `default_tag` was **not** empty
      # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
      # @param options [Hash] the options.
      # @return [String] the final value of `default_tag`.
      def preserve_default_tag(person, options)
        if account = person.account
          if account.as_update.key?("default_tag")
            if original = person.original_doc.dig("account", "default_tag")
              person.account.default_tag = original
            end
          end
        end
        person.account&.default_tag
      end

    end
  end
end

Version data entries

110 entries across 110 versions & 1 rubygems

Version Path
eco-helpers-2.0.47 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.46 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.45 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.44 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.43 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.42 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.41 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.40 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.39 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.38 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.37 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.36 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.35 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.34 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.33 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.32 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.31 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.30 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.29 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.0.28 lib/eco/api/microcases/preserve_default_tag.rb