Skip to content

Commit

Permalink
Fix call to process_tasks to run the right thing
Browse files Browse the repository at this point in the history
  • Loading branch information
d-m-u committed Apr 5, 2018
1 parent dcde0d6 commit b863530
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 6 additions & 1 deletion app/models/mixins/process_tasks_mixin.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
module ProcessTasksMixin
extend ActiveSupport::Concern
include RetirementMixin

module ClassMethods
# Processes tasks received from the UI and queues them
def process_tasks(options)
raise _("No ids given to process_tasks") if options[:ids].blank?
if options[:task] == "refresh_ems" && respond_to?("refresh_ems")

if options[:task] == 'retire_now'
options = {:task => options[:task], :userid => User.current_user.try(:userid), :src_ids => options[:ids]}
name.constantize.make_retire_request(@request_id, options)
elsif options[:task] == "refresh_ems" && respond_to?("refresh_ems")
refresh_ems(options[:ids])
msg = "'#{options[:task]}' initiated for #{options[:ids].length} #{ui_lookup(:table => base_class.name).pluralize}"
task_audit_event(:success, options, :message => msg)
Expand Down
7 changes: 3 additions & 4 deletions app/models/mixins/retirement_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ module RetirementMixin
end

module ClassMethods
def make_retire_request
options = {:task => task, :userid => current_user, :ids => objs, :src_ids => objs}
(klass.to_s + "RetireRequest").constantize.make_request(@request_id, options, current_user)
def make_retire_request(request_id, options)
(name + "RetireRequest").constantize.make_request(request_id, options, User.current_user, true)
end

def retire(ids, options = {})
Expand Down Expand Up @@ -121,7 +120,7 @@ def retirement_check
_log.log_backtrace(err)
end
end

_log.info("#{retirement_due?} : is value for if retirement is due DREWDREWDREW")
make_retire_request if retirement_due?
end

Expand Down

0 comments on commit b863530

Please sign in to comment.