Sha256: 41ff99918dca660493715fbb34f814d2259ff0adfc032666221d276128081bb9
Contents?: true
Size: 1.09 KB
Versions: 23
Compression:
Stored size: 1.09 KB
Contents
module Eco module API class MicroCases # When the input data, or `entry`, does not provide the `default_tag`, # it sets the `default_tag` of the user following some criteria # @note it assumes `default_tag` has been already set to `person.account` # @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 options [Hash] the options def refresh_default_tag(entry, person, options) return unless person.account return if options.dig(:exclude, :account) return if options.dig(:exclude, :filter_tags) return if options.dig(:exclude, :default_tag) return if entry&.default_tag? if session.tagtree person.account.default_tag = session.tagtree.default_tag(*person.filter_tags) else tags = person.filter_tags || [] person.account.default_tag = tags.first unless tags.length > 1 end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems