Class: QaServer::CheckStatusPresenter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authorities_list:, connection_status_data:, accuracy_status_data:) ⇒ CheckStatusPresenter

Returns a new instance of CheckStatusPresenter.

Parameters:

  • authorities_list (Array<String>)

    a list of all loaded authorities’ names

  • status_data (Array<Hash>)

    a list of status data for each scenario tested



7
8
9
10
11
# File 'app/presenters/qa_server/check_status_presenter.rb', line 7

def initialize(authorities_list:, connection_status_data:, accuracy_status_data:)
  @authorities_list = authorities_list
  @connection_status_data = connection_status_data
  @accuracy_status_data = accuracy_status_data
end

Instance Attribute Details

#accuracy_status_dataArray<Hash> (readonly)

rubocop:disable Style/AsciiComments

Examples:

[ { status: :PASS,
    status_label: '√',
    authority_name: 'LOCNAMES_LD4L_CACHE',
    subauthority_name: 'person',
    service: 'ld4l_cache',
    action: 'search',
    expected: 10,
    actual: 8,
    url: '/qa/search/linked_data/locnames_ld4l_cache/person?q=mark twain&maxRecords=20',
    err_message: '' }, ... ]

Returns:

  • (Array<Hash>)

    A list of status data for each accuracy scenario tested.



44
45
46
# File 'app/presenters/qa_server/check_status_presenter.rb', line 44

def accuracy_status_data
  @accuracy_status_data
end

#authorities_listArray<String> (readonly)

Returns A list of all loaded authorities’ names.

Examples:

‘AGROVOC_DIRECT’, ‘AGROVOC_LD4L_CACHE’, ‘LOCNAMES_LD4L_CACHE’

Returns:

  • (Array<String>)

    A list of all loaded authorities’ names



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

def authorities_list
  @authorities_list
end

#connection_status_dataArray<Hash> (readonly)

rubocop:disable Style/AsciiComments

Examples:

[ { status: :PASS,
    status_label: '√',
    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: '' }, ... ]

Returns:

  • (Array<Hash>)

    A list of status data for each connection scenario tested.



28
29
30
# File 'app/presenters/qa_server/check_status_presenter.rb', line 28

def connection_status_data
  @connection_status_data
end

Instance Method Details

#accuracy_status_data?Boolean

Returns true if status data exists; otherwise false.

Returns:

  • (Boolean)

    true if status data exists; otherwise false



53
54
55
# File 'app/presenters/qa_server/check_status_presenter.rb', line 53

def accuracy_status_data?
  @accuracy_status_data.present?
end

#connection_status_data?Boolean

Returns true if status data exists; otherwise false.

Returns:

  • (Boolean)

    true if status data exists; otherwise false



48
49
50
# File 'app/presenters/qa_server/check_status_presenter.rb', line 48

def connection_status_data?
  @connection_status_data.present?
end

#label_all_checksObject



102
103
104
# File 'app/presenters/qa_server/check_status_presenter.rb', line 102

def label_all_checks
  "#{value_check_param}_#{value_all_checks}".downcase.to_sym
end

#label_check_accuracyObject



94
95
96
# File 'app/presenters/qa_server/check_status_presenter.rb', line 94

def label_check_accuracy
  "#{value_check_param}_#{value_check_accuracy}".downcase.to_sym
end

#label_check_connectionsObject



86
87
88
# File 'app/presenters/qa_server/check_status_presenter.rb', line 86

def label_check_connections
  "#{value_check_param}_#{value_check_connections}".downcase.to_sym
end

#status_label(status) ⇒ String

Returns the name of the css style class to use for the status cell based on the status of the scenario test.

Returns:

  • (String)

    the name of the css style class to use for the status cell based on the status of the scenario test.



63
64
65
66
67
68
69
70
71
72
# File 'app/presenters/qa_server/check_status_presenter.rb', line 63

def status_label(status)
  case status[:status]
  when :good
    QaServer::ScenarioRunHistory::GOOD_MARKER
  when :bad
    QaServer::ScenarioRunHistory::BAD_MARKER
  when :unknown
    QaServer::ScenarioRunHistory::UNKNOWN_MARKER
  end
end

#status_style_class(status) ⇒ String

Returns the name of the css style class to use for the status cell based on the status of the scenario test.

Returns:

  • (String)

    the name of the css style class to use for the status cell based on the status of the scenario test.



58
59
60
# File 'app/presenters/qa_server/check_status_presenter.rb', line 58

def status_style_class(status)
  "status-#{status[:status]}"
end

#value_all_checksObject



98
99
100
# File 'app/presenters/qa_server/check_status_presenter.rb', line 98

def value_all_checks
  QaServer::AuthorityValidationController::ALL_VALIDATIONS
end

#value_all_collectionsObject



74
75
76
# File 'app/presenters/qa_server/check_status_presenter.rb', line 74

def value_all_collections
  QaServer::CheckStatusController::ALL_AUTHORITIES
end

#value_check_accuracyObject



90
91
92
# File 'app/presenters/qa_server/check_status_presenter.rb', line 90

def value_check_accuracy
  QaServer::AuthorityValidationController::VALIDATE_ACCURACY
end

#value_check_connectionsObject



82
83
84
# File 'app/presenters/qa_server/check_status_presenter.rb', line 82

def value_check_connections
  QaServer::AuthorityValidationController::VALIDATE_CONNECTIONS
end

#value_check_paramObject



78
79
80
# File 'app/presenters/qa_server/check_status_presenter.rb', line 78

def value_check_param
  QaServer::AuthorityValidationController::VALIDATION_TYPE_PARAM
end