lib/eco/api/microcases/append_usergroups.rb in eco-helpers-2.7.24 vs lib/eco/api/microcases/append_usergroups.rb in eco-helpers-2.7.25

- old
+ new

@@ -4,15 +4,13 @@ # It preserves the usergroups of `person` and appends those defined in `policy_group_ids` of the `entry` # @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 append_usergroups(entry, person, options) - unless options.dig(:exclude, :account) - if person.account - person.account.policy_group_ids |= entry.policy_group_ids - end - end - end + return if options.dig(:exclude, :account) + return unless person.account + person.account.policy_group_ids |= entry.policy_group_ids + end end end end