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.7.24 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.23 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.22 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.21 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.20 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.19 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.18 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.17 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.16 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.15 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.14 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.13 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.12 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.4 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.2 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.1 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.7.0 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.6.4 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.6.3 lib/eco/api/microcases/preserve_default_tag.rb
eco-helpers-2.6.2 lib/eco/api/microcases/preserve_default_tag.rb