class Wco::OfficeAction

def do_run

def do_run
  sch = self
  sch.update!({ status: STATUS_INACTIVE })
  begin
    eval( sch.tmpl.action_exe )
  rescue => err
    puts! err, "Wco::OfficeAction#do_run"
    ::ExceptionNotifier.notify_exception(
      err,
      data: { office_action: self }
    )
  end
  # schedule next actions & update the action
  sch.tmpl.ties.each do |tie|
    next_sch = self.class.find_or_initialize_by({
      office_action_template_id: tie.next_tmpl.id,
    })
    next_sch.perform_at = eval(tie.next_at_exe)
    next_sch.status     = STATUS_ACTIVE
    next_sch.save!
  end
end

def tmpl

def tmpl
  office_action_template
end

def to_s

def to_s
  slug
end