Class: QaServer::CheckStatusPresenter

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

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 Method Details

#accuracy_status_data ⇒ Array<Hash>

Returns A list of status data for each accuracy scenario tested.

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.



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

def accuracy_status_data
  @accuracy_status_data
end

#accuracy_status_data? ⇒ Boolean

Returns true if status data exists; otherwise false.

Returns:

  • (Boolean) —

    true if status data exists; otherwise false



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

def accuracy_status_data?
  @accuracy_status_data.present?
end

#authorities_list ⇒ Array<String>

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_data ⇒ Array<Hash>

Returns A list of status data for each connection scenario tested.

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.



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

def connection_status_data
  @connection_status_data
end

#connection_status_data? ⇒ Boolean

Returns true if status data exists; otherwise false.

Returns:

  • (Boolean) —

    true if status data exists; otherwise false



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

def connection_status_data?
  @connection_status_data.present?
end

#label_all_checks ⇒ Object



92
93
94
# File 'app/presenters/qa_server/check_status_presenter.rb', line 92

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

#label_check_accuracy ⇒ Object



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

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

#label_check_connections ⇒ Object



76
77
78
# File 'app/presenters/qa_server/check_status_presenter.rb', line 76

def label_check_connections
  "#{value_check_param}_#{value_check_connections}".downcase.to_sym
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.



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

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

#value_all_checks ⇒ Object



88
89
90
# File 'app/presenters/qa_server/check_status_presenter.rb', line 88

def value_all_checks
  AuthorityValidationController::ALL_VALIDATIONS
end

#value_all_collections ⇒ Object



64
65
66
# File 'app/presenters/qa_server/check_status_presenter.rb', line 64

def value_all_collections
  CheckStatusController::ALL_AUTHORITIES
end

#value_check_accuracy ⇒ Object



80
81
82
# File 'app/presenters/qa_server/check_status_presenter.rb', line 80

def value_check_accuracy
  AuthorityValidationController::VALIDATE_ACCURACY
end

#value_check_connections ⇒ Object



72
73
74
# File 'app/presenters/qa_server/check_status_presenter.rb', line 72

def value_check_connections
  AuthorityValidationController::VALIDATE_CONNECTIONS
end

#value_check_param ⇒ Object



68
69
70
# File 'app/presenters/qa_server/check_status_presenter.rb', line 68

def value_check_param
  AuthorityValidationController::VALIDATION_TYPE_PARAM
end