Skip to content

Commit

Permalink
Merge pull request #18117 from d-m-u/fixing_red_master
Browse files Browse the repository at this point in the history
Don't need the name, since it's mixed in...
  • Loading branch information
kbrock authored Oct 22, 2018
2 parents 132176e + 6c26947 commit 1544ad2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/models/mixins/retirement_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module ClassMethods
def make_retire_request(*src_ids, requester)
klass = (name.demodulize + "RetireRequest").constantize
options = {:src_ids => src_ids.presence, :__request_type__ => klass.request_types.first}
set_retirement_requester(name, options[:src_ids], requester)
set_retirement_requester(options[:src_ids], requester)
klass.make_request(nil, options, requester, true)
end

Expand All @@ -28,13 +28,13 @@ def retire(ids, options = {})
MiqQueue.put(q_options)
end

def set_retirement_requester(klass, obj_ids, requester)
existing_objects = klass.where(:id => obj_ids)
def set_retirement_requester(obj_ids, requester)
existing_objects = where(:id => obj_ids)
updated_count = existing_objects.update_all(:retirement_requester => requester.userid)
if updated_count != obj_ids.count
_log.info("Retirement requester for #{klass}.pluralize #{(obj_ids - existing_objects.pluck(:id))} not set because objects not found")
_log.info("Retirement requester for #{self.name} #{(obj_ids - existing_objects.pluck(:id))} not set because objects not found")
else
_log.info("Retirement requester for #{klass}.pluralize #{obj_ids} being set to #{requester.userid}")
_log.info("Retirement requester for #{self.name} #{obj_ids} being set to #{requester.userid}")
end
end
end
Expand Down

0 comments on commit 1544ad2

Please sign in to comment.