Class: QaServer::ScenarioRunRegistry

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/qa_server/scenario_run_registry.rb

Class Method Summary collapse

Class Method Details

.latest_runObject

Get the latest saved run of scenarios.



9
10
11
12
13
14
15
# File 'app/models/qa_server/scenario_run_registry.rb', line 9

def self.latest_run
  return nil unless QaServer::ScenarioRunRegistry.last
  QaServer::ScenarioRunRegistry.last # Can we count on last to always be the one with the latest dt_stamp?
  # latest_run = ScenarioRunRegistry.all.sort(:dt_stamp).last
  # return nil if latest_run.blank?
  # latest_run.id
end

.latest_run_idObject

Get the latest saved status.



18
19
20
21
22
# File 'app/models/qa_server/scenario_run_registry.rb', line 18

def self.latest_run_id
  latest = latest_run
  return nil unless latest
  lastest.id
end

.save_run(scenarios_results:) ⇒ Object



24
25
26
27
# File 'app/models/qa_server/scenario_run_registry.rb', line 24

def self.save_run(scenarios_results:)
  run = QaServer::ScenarioRunRegistry.create(dt_stamp: dt_stamp_now_et)
  scenarios_results.each { |result| QaServer::ScenarioRunHistory.save_result(run_id: run.id, scenario_result: result) }
end