Method: RulesEngine::Process::DbRunner#history

Defined in:
lib/rules_engine/process/runner/db_runner.rb

#history(plan_code = nil, options = {}) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/rules_engine/process/runner/db_runner.rb', line 57

def history(plan_code = nil, options = {})
  
  re_process_runs = ReProcessRun.history(plan_code, options)

  {  "next_page" => re_process_runs.next_page, 
     "previous_page" => re_process_runs.previous_page,
     "processes" => re_process_runs.map do |re_process_run| 
        { 
          "process_id" => re_process_run.id,  
          "plan_code" => re_process_run.plan_code, 
          "plan_version" => re_process_run.plan_version, 
          "process_status" => re_process_run.process_status,  
          "started_at" => re_process_run.started_at.nil? ? nil : re_process_run.started_at.utc.to_s, 
          "finished_at" =>re_process_run.finished_at.nil? ? nil : re_process_run.finished_at.utc.to_s
        }
      end
  }
end