Class: QaServer::MonitorStatus::CurrentStatusPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/qa_server/monitor_status/current_status_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent:, current_summary:, current_failure_data:) ⇒ CurrentStatusPresenter

Returns a new instance of CurrentStatusPresenter.

Parameters:



8
9
10
11
12
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 8

def initialize(parent:, current_summary:, current_failure_data:)
  @parent = parent
  @current_summary = current_summary
  @current_failure_data = current_failure_data
end

Instance Method Details

#authorities_countInteger

Returns number of loaded authorities.

Returns:

  • (Integer)

    number of loaded authorities



35
36
37
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 35

def authorities_count
  @current_summary.authority_count
end

#authorities_count_styleString

Returns css style class representing whether all tests passed or any failed.

Returns:

  • (String)

    css style class representing whether all tests passed or any failed



45
46
47
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 45

def authorities_count_style
  failures? ? 'status-bad' : 'status-good'
end

#failing_authorities_countInteger

Returns number of authorities with failing tests in the latest test run.

Returns:

  • (Integer)

    number of authorities with failing tests in the latest test run



40
41
42
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 40

def failing_authorities_count
  @current_failure_data.map { |f| f[:authority_name] }.uniq.count
end

#failing_tests_countInteger

Returns number of failing tests in the latest test run.

Returns:

  • (Integer)

    number of failing tests in the latest test run



60
61
62
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 60

def failing_tests_count
  @current_summary.failing_scenario_count
end

#failing_tests_styleString

Returns css style class representing whether all tests passed or any failed.

Returns:

  • (String)

    css style class representing whether all tests passed or any failed



65
66
67
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 65

def failing_tests_style
  failures? ? 'summary-status-bad' : 'status-good'
end

#failuresArray<Hash>

Returns A list of failures data in the latest test run, if any.

Examples:

[ { status: :FAIL,
    status_label: 'X',
    authority_name: 'LOCNAMES_LD4L_CACHE',
    subauthority_name: 'person',
    service: 'ld4l_cache',
    action: 'search',
    url: '/qa/search/linked_data/locnames_ld4l_cache/person?q=mark twain&maxRecords=4',
    err_message: 'Exception: Something went wrong.' }, ... ]

Returns:

  • (Array<Hash>)

    A list of failures data in the latest test run, if any



79
80
81
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 79

def failures
  @current_failure_data
end

#failures?Boolean

Returns true if failure data exists for the latest test run; otherwise false.

Returns:

  • (Boolean)

    true if failure data exists for the latest test run; otherwise false



84
85
86
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 84

def failures?
  failing_tests_count.positive? && !failures.nil?
end

#first_updatedString

Returns date with time of first recorded test run.

Returns:

  • (String)

    date with time of first recorded test run



30
31
32
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 30

def first_updated
  QaServer::TimeService.pretty_time(first_updated_dt)
end

#first_updated_dtActiveSupport::TimeWithZone

Returns date time stamp of first recorded test run.

Returns:

  • (ActiveSupport::TimeWithZone)

    date time stamp of first recorded test run



25
26
27
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 25

def first_updated_dt
  QaServer::ScenarioRunRegistry.first_run_dt
end

#last_updatedString

Returns date with time of last test run.

Returns:

  • (String)

    date with time of last test run



20
21
22
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 20

def last_updated
  QaServer::TimeService.pretty_time(last_updated_dt)
end

#last_updated_dtActiveSupport::TimeWithZone

Returns date time stamp of last test run.

Returns:

  • (ActiveSupport::TimeWithZone)

    date time stamp of last test run



15
16
17
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 15

def last_updated_dt
  @current_summary.run_dt_stamp
end

#passing_tests_countInteger

Returns number of passing tests in the latest test run.

Returns:

  • (Integer)

    number of passing tests in the latest test run



55
56
57
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 55

def passing_tests_count
  @current_summary.passing_scenario_count
end

#tests_countInteger

Returns number of tests in the latest test run.

Returns:

  • (Integer)

    number of tests in the latest test run



50
51
52
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 50

def tests_count
  @current_summary.total_scenario_count
end