Class: QaServer::CheckStatusPresenter
- Inherits:
-
Object
- Object
- QaServer::CheckStatusPresenter
- Defined in:
- app/presenters/qa_server/check_status_presenter.rb
Instance Attribute Summary collapse
-
#accuracy_status_data ⇒ Array<Hash>
readonly
rubocop:disable Style/AsciiComments.
-
#authorities_list ⇒ Array<String>
readonly
A list of all loaded authorities’ names.
-
#comparison_status_data ⇒ Array<Hash>
readonly
rubocop:disable Style/AsciiComments.
-
#connection_status_data ⇒ Array<Hash>
readonly
rubocop:disable Style/AsciiComments.
Instance Method Summary collapse
-
#accuracy_status_data? ⇒ Boolean
True if status data exists; otherwise false.
- #accuracy_tests_checked ⇒ Object
-
#comparison_status_data? ⇒ Boolean
True if status data exists; otherwise false.
- #comparison_tests_checked ⇒ Object
-
#connection_status_data? ⇒ Boolean
True if status data exists; otherwise false.
- #connection_tests_checked ⇒ Object
-
#initialize(authorities_list:, connection_status_data:, accuracy_status_data:, comparison_status_data:) ⇒ CheckStatusPresenter
constructor
A new instance of CheckStatusPresenter.
- #label_all_checks ⇒ Object
- #label_check_accuracy ⇒ Object
- #label_check_comparison ⇒ Object
- #label_check_connections ⇒ Object
- #selected_authority ⇒ Object
- #selected_comparison ⇒ Object
-
#status_label(status) ⇒ String
The name of the css style class to use for the status cell based on the status of the scenario test.
-
#status_style_class(status) ⇒ String
The name of the css style class to use for the status cell based on the status of the scenario test.
- #value_all_checks ⇒ Object
- #value_all_collections ⇒ Object
- #value_check_accuracy ⇒ Object
- #value_check_comparison ⇒ Object
- #value_check_connections ⇒ Object
- #value_check_param ⇒ Object
Constructor Details
#initialize(authorities_list:, connection_status_data:, accuracy_status_data:, comparison_status_data:) ⇒ CheckStatusPresenter
Returns a new instance of CheckStatusPresenter.
7 8 9 10 11 12 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 7 def initialize(authorities_list:, connection_status_data:, accuracy_status_data:, comparison_status_data:) @authorities_list = @connection_status_data = connection_status_data @accuracy_status_data = accuracy_status_data @comparison_status_data = comparison_status_data end |
Instance Attribute Details
#accuracy_status_data ⇒ Array<Hash> (readonly)
rubocop:disable Style/AsciiComments
45 46 47 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 45 def accuracy_status_data @accuracy_status_data end |
#authorities_list ⇒ Array<String> (readonly)
Returns A list of all loaded authorities’ names.
16 17 18 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 16 def @authorities_list end |
#comparison_status_data ⇒ Array<Hash> (readonly)
rubocop:disable Style/AsciiComments
64 65 66 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 64 def comparison_status_data @comparison_status_data end |
#connection_status_data ⇒ Array<Hash> (readonly)
rubocop:disable Style/AsciiComments
29 30 31 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 29 def connection_status_data @connection_status_data end |
Instance Method Details
#accuracy_status_data? ⇒ Boolean
Returns true if status data exists; otherwise false.
73 74 75 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 73 def accuracy_status_data? @accuracy_status_data.present? end |
#accuracy_tests_checked ⇒ Object
139 140 141 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 139 def accuracy_tests_checked accuracy_status_data? end |
#comparison_status_data? ⇒ Boolean
Returns true if status data exists; otherwise false.
78 79 80 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 78 def comparison_status_data? @comparison_status_data.present? end |
#comparison_tests_checked ⇒ Object
151 152 153 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 151 def comparison_tests_checked comparison_status_data? end |
#connection_status_data? ⇒ Boolean
Returns true if status data exists; otherwise false.
68 69 70 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 68 def connection_status_data? @connection_status_data.present? end |
#connection_tests_checked ⇒ Object
127 128 129 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 127 def connection_tests_checked connection_status_data? end |
#label_all_checks ⇒ Object
159 160 161 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 159 def label_all_checks "#{value_check_param}_#{value_all_checks}".downcase.to_sym end |
#label_check_accuracy ⇒ Object
135 136 137 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 135 def label_check_accuracy "#{value_check_param}_#{value_check_accuracy}".downcase.to_sym end |
#label_check_comparison ⇒ Object
147 148 149 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 147 def label_check_comparison "#{value_check_param}_#{value_check_comparison}".downcase.to_sym end |
#label_check_connections ⇒ Object
123 124 125 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 123 def label_check_connections "#{value_check_param}_#{value_check_connections}".downcase.to_sym end |
#selected_authority ⇒ Object
100 101 102 103 104 105 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 100 def return comparison_status_data.first[:authority_name][0].to_sym if comparison_status_data? return connection_status_data.first[:authority_name].to_sym if connection_status_data? return accuracy_status_data.first[:authority_name].to_sym if accuracy_status_data? "" end |
#selected_comparison ⇒ Object
107 108 109 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 107 def selected_comparison comparison_status_data? ? comparison_status_data.first[:authority_name][1].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.
89 90 91 92 93 94 95 96 97 98 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 89 def status_label(status) case 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.
83 84 85 86 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 83 def status_style_class(status) return "status-#{status}" unless status.is_a? Hash status[:pending] ? "status-dogear status-#{status[:status]}" : "status-#{status[:status]}" end |
#value_all_checks ⇒ Object
155 156 157 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 155 def value_all_checks QaServer::AuthorityValidationBehavior::ALL_VALIDATIONS end |
#value_all_collections ⇒ Object
111 112 113 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 111 def value_all_collections QaServer::CheckStatusController::ALL_AUTHORITIES end |
#value_check_accuracy ⇒ Object
131 132 133 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 131 def value_check_accuracy QaServer::AuthorityValidationBehavior::VALIDATE_ACCURACY end |
#value_check_comparison ⇒ Object
143 144 145 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 143 def value_check_comparison QaServer::AuthorityValidationBehavior::VALIDATE_ACCURACY_COMPARISON end |
#value_check_connections ⇒ Object
119 120 121 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 119 def value_check_connections QaServer::AuthorityValidationBehavior::VALIDATE_CONNECTIONS end |
#value_check_param ⇒ Object
115 116 117 |
# File 'app/presenters/qa_server/check_status_presenter.rb', line 115 def value_check_param QaServer::AuthorityValidationBehavior::VALIDATION_TYPE_PARAM end |