qa_server 7.2.0 → 7.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop_fixme.yml +6 -0
  3. data/.travis.yml +4 -5
  4. data/CHANGELOG.md +38 -0
  5. data/Rakefile +1 -1
  6. data/app/assets/stylesheets/qa_server/_check-status.scss +36 -0
  7. data/app/cache_processors/concerns/qa_server/cache_keys.rb +0 -5
  8. data/app/cache_processors/qa_server/cache_expiry_service.rb +13 -8
  9. data/app/cache_processors/qa_server/job_id_cache.rb +29 -0
  10. data/app/cache_processors/qa_server/performance_cache.rb +34 -34
  11. data/app/cache_processors/qa_server/performance_day_graph_cache.rb +27 -0
  12. data/app/cache_processors/qa_server/performance_month_graph_cache.rb +27 -0
  13. data/app/cache_processors/qa_server/performance_year_graph_cache.rb +27 -0
  14. data/app/cache_processors/qa_server/scenario_history_cache.rb +7 -7
  15. data/app/cache_processors/qa_server/scenario_history_graph_cache.rb +12 -17
  16. data/app/cache_processors/qa_server/scenario_run_cache.rb +8 -8
  17. data/app/cache_processors/qa_server/scenario_run_failures_cache.rb +7 -7
  18. data/app/cache_processors/qa_server/scenario_run_summary_cache.rb +7 -7
  19. data/app/controllers/concerns/qa_server/authority_validation_behavior.rb +49 -44
  20. data/app/controllers/qa_server/check_status_controller.rb +92 -22
  21. data/app/controllers/qa_server/fetch_controller.rb +36 -36
  22. data/app/controllers/qa_server/monitor_status_controller.rb +105 -105
  23. data/app/jobs/qa_server/history_graph_job.rb +28 -0
  24. data/app/jobs/qa_server/monitor_tests_job.rb +19 -39
  25. data/app/jobs/qa_server/performance_day_graph_job.rb +45 -0
  26. data/app/jobs/qa_server/performance_month_graph_job.rb +45 -0
  27. data/app/jobs/qa_server/performance_per_byte_job.rb +85 -0
  28. data/app/jobs/qa_server/performance_year_graph_job.rb +45 -0
  29. data/app/loggers/qa_server/scenario_logger.rb +74 -4
  30. data/app/models/concerns/qa_server/performance_history_data_keys.rb +8 -0
  31. data/app/models/qa_server/authority_scenario.rb +4 -4
  32. data/app/models/qa_server/authority_status.rb +2 -2
  33. data/app/models/qa_server/authority_status_failure.rb +1 -1
  34. data/app/models/qa_server/performance_history.rb +2 -2
  35. data/app/models/qa_server/scenario_run_history.rb +52 -52
  36. data/app/models/qa_server/scenario_run_registry.rb +2 -2
  37. data/app/models/qa_server/scenarios.rb +26 -26
  38. data/app/models/qa_server/search_scenario.rb +18 -13
  39. data/app/models/qa_server/term_scenario.rb +29 -29
  40. data/app/prepends/prepended_linked_data/find_term.rb +40 -40
  41. data/app/prepends/prepended_linked_data/search_query.rb +36 -36
  42. data/app/prepends/prepended_rdf/rdf_graph.rb +7 -7
  43. data/app/presenters/concerns/qa_server/monitor_status/performance_datatable_behavior.rb +32 -32
  44. data/app/presenters/concerns/qa_server/monitor_status/performance_graph_behavior.rb +64 -64
  45. data/app/presenters/qa_server/check_status_presenter.rb +63 -7
  46. data/app/services/concerns/qa_server/gruff_graph.rb +16 -16
  47. data/app/services/qa_server/authority_loader_service.rb +14 -14
  48. data/app/services/qa_server/authority_validator_service.rb +1 -0
  49. data/app/services/qa_server/database_migrator.rb +14 -14
  50. data/app/services/qa_server/history_graphing_service.rb +30 -30
  51. data/app/services/qa_server/performance_calculator_service.rb +80 -80
  52. data/app/services/qa_server/performance_datatable_service.rb +35 -35
  53. data/app/services/qa_server/performance_graph_data_service.rb +28 -28
  54. data/app/services/qa_server/performance_graphing_service.rb +58 -58
  55. data/app/services/qa_server/performance_per_byte_calculator_service.rb +88 -0
  56. data/app/services/qa_server/performance_per_byte_data_service.rb +41 -0
  57. data/app/services/qa_server/scenarios_loader_service.rb +1 -1
  58. data/app/services/qa_server/time_period_service.rb +21 -21
  59. data/app/validators/qa_server/scenario_validator.rb +99 -87
  60. data/app/validators/qa_server/search_scenario_validator.rb +67 -61
  61. data/app/validators/qa_server/term_scenario_validator.rb +20 -15
  62. data/app/views/qa_server/check_status/index.html.erb +120 -24
  63. data/config/i18n-tasks.yml +133 -0
  64. data/config/locales/qa_server.en.yml +15 -0
  65. data/lib/generators/qa_server/assets_generator.rb +4 -4
  66. data/lib/generators/qa_server/templates/config/authorities/linked_data/cerl_ld4l_cache.json +2 -2
  67. data/lib/generators/qa_server/templates/config/authorities/linked_data/getty_aat_ld4l_cache.json +62 -1
  68. data/lib/generators/qa_server/templates/config/authorities/linked_data/getty_tgn_ld4l_cache.json +28 -4
  69. data/lib/generators/qa_server/templates/config/authorities/linked_data/isni_ld4l_cache.json +90 -0
  70. data/lib/generators/qa_server/templates/config/authorities/linked_data/ligatus_ld4l_cache.json +133 -0
  71. data/lib/generators/qa_server/templates/config/authorities/linked_data/locnames_rwo2_ld4l_cache.json +248 -0
  72. data/lib/generators/qa_server/templates/config/authorities/linked_data/locnames_rwo3_ld4l_cache.json +248 -0
  73. data/lib/generators/qa_server/templates/config/authorities/linked_data/locvocabs_ld4l_cache.json +117 -0
  74. data/lib/generators/qa_server/templates/config/authorities/linked_data/mesh_nlm_ld4l_cache.json +135 -3
  75. data/lib/generators/qa_server/templates/config/authorities/linked_data/oclcfast_direct.json +1 -0
  76. data/lib/generators/qa_server/templates/config/authorities/linked_data/oclcfast_ld4l_cache.json +1 -4
  77. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/agrovoc_direct_validation.yml +31 -0
  78. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/agrovoc_ld4l_cache_validation.yml +31 -0
  79. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/cerl_ld4l_cache_validation.yml +23 -11
  80. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/dbpedia_ld4l_cache_validation.yml +33 -0
  81. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/geonames_direct_validation.yml +35 -0
  82. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/geonames_ld4l_cache_validation.yml +58 -5
  83. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/getty_aat_ld4l_cache_validation.yml +256 -0
  84. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/getty_tgn_ld4l_cache_validation.yml +35 -1
  85. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/getty_ulan_ld4l_cache_validation.yml +37 -0
  86. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/isni_ld4l_cache_validation.yml +10 -0
  87. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/ligatus_ld4l_cache_validation.yml +36 -0
  88. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locdemographics_ld4l_cache_validation.yml +73 -44
  89. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locgenres_ld4l_cache_validation.yml +31 -0
  90. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locnames_ld4l_cache_validation.yml +71 -0
  91. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locnames_rwo_ld4l_cache_validation.yml +70 -2
  92. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locperformance_ld4l_cache_validation.yml +6 -0
  93. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locsubjects_ld4l_cache_validation.yml +32 -0
  94. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locvocabs_ld4l_cache_validation.yml +184 -0
  95. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/mesh_nlm_ld4l_cache_validation.yml +51 -1
  96. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/nalt_ld4l_cache_validation.yml +37 -0
  97. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/oclc_fast_validation.yml +71 -5
  98. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/oclcfast_direct_validation.yml +66 -1
  99. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/oclcfast_ld4l_cache_validation.yml +57 -0
  100. data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/rda_registry_ld4l_cache_validation.yml +310 -0
  101. data/lib/qa_server/configuration.rb +28 -24
  102. data/lib/qa_server/version.rb +1 -1
  103. data/qa_server.gemspec +2 -1
  104. data/spec/feature/accuracy_spec.rb +32 -0
  105. data/spec/i18n_spec.rb +36 -0
  106. data/spec/spec_helper.rb +4 -0
  107. metadata +46 -12
  108. data/app/cache_processors/qa_server/performance_daily_graph_cache.rb +0 -60
  109. data/app/cache_processors/qa_server/performance_hourly_graph_cache.rb +0 -65
  110. data/app/cache_processors/qa_server/performance_monthly_graph_cache.rb +0 -60
@@ -17,46 +17,46 @@ module PrependedLinkedData::SearchQuery
17
17
  requested_results(full_results)
18
18
  end
19
19
 
20
- private
21
-
22
- def setup_search(request_header: {}, language: nil, replacements: {}, subauth: nil, context: false, performance_data: false) # rubocop:disable Metrics/ParameterLists
23
- QaServer.log_agent_info(request_header[:request])
24
- @start_time_s = QaServer::TimeService.current_time_s
25
- request_header = build_request_header(language: language, replacements: replacements, subauth: subauth, context: context, performance_data: performance_data) if request_header.empty?
26
- @saved_performance_data = performance_data || request_header[:performance_data]
27
- request_header[:performance_data] = true
28
- request_header
29
- end
20
+ private
21
+
22
+ def setup_search(request_header: {}, language: nil, replacements: {}, subauth: nil, context: false, performance_data: false) # rubocop:disable Metrics/ParameterLists
23
+ QaServer.log_agent_info(request_header[:request])
24
+ @start_time_s = QaServer::TimeService.current_time_s
25
+ request_header = build_request_header(language: language, replacements: replacements, subauth: subauth, context: context, performance_data: performance_data) if request_header.empty?
26
+ @saved_performance_data = performance_data || request_header[:performance_data]
27
+ request_header[:performance_data] = true
28
+ request_header
29
+ end
30
30
 
31
- def update_performance_history_record(full_results)
32
- return QaServer.config.performance_cache.destroy(@phid) unless full_results.is_a?(Hash) && full_results.key?(:performance)
33
- updates = { action_time_ms: (QaServer::TimeService.current_time_s - @start_time_s) * 1000,
34
- size_bytes: full_results[:performance][:fetched_bytes],
35
- retrieve_plus_graph_load_time_ms: full_results[:performance][:fetch_time_s] * 1000,
36
- normalization_time_ms: full_results[:performance][:normalization_time_s] * 1000 }
37
- QaServer.config.performance_cache.update(id: @phid, updates: updates)
38
- QaServer.config.performance_cache.complete_entry(id: @phid)
39
- end
31
+ def update_performance_history_record(full_results)
32
+ return QaServer.config.performance_cache.destroy(@phid) unless full_results.is_a?(Hash) && full_results.key?(:performance)
33
+ updates = { action_time_ms: (QaServer::TimeService.current_time_s - @start_time_s) * 1000,
34
+ size_bytes: full_results[:performance][:fetched_bytes],
35
+ retrieve_plus_graph_load_time_ms: full_results[:performance][:fetch_time_s] * 1000,
36
+ normalization_time_ms: full_results[:performance][:normalization_time_s] * 1000 }
37
+ QaServer.config.performance_cache.update(id: @phid, updates: updates)
38
+ QaServer.config.performance_cache.complete_entry(id: @phid)
39
+ end
40
40
 
41
- # Override to append performance history record id into the URL to allow access to the record in RDF::Graph
42
- def load_graph(url:)
43
- return super if QaServer.config.suppress_performance_gathering?
41
+ # Override to append performance history record id into the URL to allow access to the record in RDF::Graph
42
+ def load_graph(url:)
43
+ return super if QaServer.config.suppress_performance_gathering?
44
44
 
45
- access_start_dt = QaServer::TimeService.current_time
45
+ access_start_dt = QaServer::TimeService.current_time
46
46
 
47
- url += "&phid=#{@phid}"
48
- @full_graph = graph_service.load_graph(url: url)
47
+ url += "&phid=#{@phid}"
48
+ @full_graph = graph_service.load_graph(url: url)
49
49
 
50
- access_end_dt = QaServer::TimeService.current_time
51
- @access_time_s = access_end_dt - access_start_dt
52
- @fetched_size = full_graph.triples.to_s.size if performance_data?
53
- Rails.logger.info("Time to receive data from authority: #{access_time_s}s")
54
- end
50
+ access_end_dt = QaServer::TimeService.current_time
51
+ @access_time_s = access_end_dt - access_start_dt
52
+ @fetched_size = full_graph.triples.to_s.size if performance_data?
53
+ Rails.logger.info("Time to receive data from authority: #{access_time_s}s")
54
+ end
55
55
 
56
- def requested_results(full_results)
57
- return full_results if @saved_performance_data
58
- return full_results[:results] unless full_results.key? :response_header
59
- full_results.delete(:performance)
60
- full_results
61
- end
56
+ def requested_results(full_results)
57
+ return full_results if @saved_performance_data
58
+ return full_results[:results] unless full_results.key? :response_header
59
+ full_results.delete(:performance)
60
+ full_results
61
+ end
62
62
  end
@@ -46,12 +46,12 @@ module PrependedRdf::RdfGraph
46
46
  QaServer.config.performance_tracker.write "#{format('%.6f', end_time_s - start_time_s)}, " # load graph
47
47
  end
48
48
 
49
- private
49
+ private
50
50
 
51
- def parse_phid(url)
52
- i = url.rindex('&phid=')
53
- phid = url[(i + 6)..url.length]
54
- adjusted_url = url[0..(i - 1)]
55
- [phid, adjusted_url]
56
- end
51
+ def parse_phid(url)
52
+ i = url.rindex('&phid=')
53
+ phid = url[(i + 6)..url.length]
54
+ adjusted_url = url[0..(i - 1)]
55
+ [phid, adjusted_url]
56
+ end
57
57
  end
@@ -116,44 +116,44 @@ module QaServer::MonitorStatus
116
116
  QaServer::TimeService.pretty_date(performance_data_end_dt)
117
117
  end
118
118
 
119
- private
119
+ private
120
120
 
121
- def expected_time_period
122
- QaServer.config.performance_datatable_default_time_period
123
- end
121
+ def expected_time_period
122
+ QaServer.config.performance_datatable_default_time_period
123
+ end
124
124
 
125
- def data_table_for(authority_data, action)
126
- authority_data[action]
127
- end
125
+ def data_table_for(authority_data, action)
126
+ authority_data[action]
127
+ end
128
128
 
129
- def unsupported_action?(stats)
130
- values = stats.values
131
- return true if values.all?(&:zero?)
132
- values.any? { |v| v.respond_to?(:nan?) && v.nan? }
133
- end
129
+ def unsupported_action?(stats)
130
+ values = stats.values
131
+ return true if values.all?(&:zero?)
132
+ values.any? { |v| v.respond_to?(:nan?) && v.nan? }
133
+ end
134
134
 
135
- def format_stat(stats, idx)
136
- return '' if stats[idx].nil? || unsupported_action?(stats)
137
- format("%0.1f", stats[idx])
138
- end
135
+ def format_stat(stats, idx)
136
+ return '' if stats[idx].nil? || unsupported_action?(stats)
137
+ format("%0.1f", stats[idx])
138
+ end
139
139
 
140
- def performance_style_class(stats, stat_key)
141
- return "status-not-supported" if unsupported_action?(stats)
142
- return "status-bad" if max_threshold_exceeded(stats, stat_key)
143
- return "status-unknown" if desired_threshold_not_met(stats, stat_key)
144
- "status-good"
145
- end
140
+ def performance_style_class(stats, stat_key)
141
+ return "status-not-supported" if unsupported_action?(stats)
142
+ return "status-bad" if max_threshold_exceeded(stats, stat_key)
143
+ return "status-unknown" if desired_threshold_not_met(stats, stat_key)
144
+ "status-good"
145
+ end
146
146
 
147
- def max_threshold_exceeded(stats, stat_key)
148
- return false if stats[stat_key].nil?
149
- return true if stats[stat_key] > QaServer.config.performance_datatable_max_threshold
150
- false
151
- end
147
+ def max_threshold_exceeded(stats, stat_key)
148
+ return false if stats[stat_key].nil?
149
+ return true if stats[stat_key] > QaServer.config.performance_datatable_max_threshold
150
+ false
151
+ end
152
152
 
153
- def desired_threshold_not_met(stats, stat_key)
154
- return false if stats[stat_key].nil?
155
- return true unless stats[stat_key] < QaServer.config.performance_datatable_warning_threshold
156
- false
157
- end
153
+ def desired_threshold_not_met(stats, stat_key)
154
+ return false if stats[stat_key].nil?
155
+ return true unless stats[stat_key] < QaServer.config.performance_datatable_warning_threshold
156
+ false
157
+ end
158
158
  end
159
159
  end
@@ -83,73 +83,73 @@ module QaServer::MonitorStatus
83
83
  false
84
84
  end
85
85
 
86
- private
87
-
88
- def default_graph?(graph_info) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
89
- return false unless performance_all_actions_graph?(graph_info)
90
- return true if QaServer.config.performance_graph_default_time_period == :day && performance_day_graph?(graph_info)
91
- return true if QaServer.config.performance_graph_default_time_period == :month && performance_month_graph?(graph_info)
92
- return true if QaServer.config.performance_graph_default_time_period == :year && performance_year_graph?(graph_info)
93
- false
94
- end
95
-
96
- def performance_graphs_for_authority(graphs, auth_name)
97
- [:search, :fetch, :all_actions].each do |action|
98
- day_graph = performance_for_day_graph(auth_name, action)
99
- month_graph = performance_for_month_graph(auth_name, action)
100
- year_graph = performance_for_year_graph(auth_name, action)
101
- add_graphs(graphs, day_graph, month_graph, year_graph)
102
- end
103
- end
86
+ private
104
87
 
105
- # only add the graphs if all 3 exist
106
- def add_graphs(graphs, day_graph, month_graph, year_graph)
107
- return unless day_graph[:exists] && month_graph[:exists] && year_graph[:exists]
108
- graphs << day_graph
109
- graphs << month_graph
110
- graphs << year_graph
111
- end
112
-
113
- def performance_for_day_graph(auth_name, action)
114
- filepath = QaServer::PerformanceGraphingService.performance_graph_image_path(authority_name: auth_name, action: action, time_period: :day)
115
- exists = QaServer::PerformanceGraphingService.performance_graph_image_exists?(authority_name: auth_name, action: action, time_period: :day)
116
- {
117
- action: action,
118
- time_period: :day,
119
- graph: filepath,
120
- exists: exists,
121
- label: "Performance data for the last 24 hours.",
122
- authority_name: auth_name,
123
- base_id: "performance-of-#{auth_name}"
124
- }
125
- end
88
+ def default_graph?(graph_info) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
89
+ return false unless performance_all_actions_graph?(graph_info)
90
+ return true if QaServer.config.performance_graph_default_time_period == :day && performance_day_graph?(graph_info)
91
+ return true if QaServer.config.performance_graph_default_time_period == :month && performance_month_graph?(graph_info)
92
+ return true if QaServer.config.performance_graph_default_time_period == :year && performance_year_graph?(graph_info)
93
+ false
94
+ end
126
95
 
127
- def performance_for_month_graph(auth_name, action)
128
- filepath = QaServer::PerformanceGraphingService.performance_graph_image_path(authority_name: auth_name, action: action, time_period: :month)
129
- exists = QaServer::PerformanceGraphingService.performance_graph_image_exists?(authority_name: auth_name, action: action, time_period: :month)
130
- {
131
- action: action,
132
- time_period: :month,
133
- graph: filepath,
134
- exists: exists,
135
- label: "Performance data for the last 30 days.",
136
- authority_name: auth_name,
137
- base_id: "performance-of-#{auth_name}"
138
- }
96
+ def performance_graphs_for_authority(graphs, auth_name)
97
+ [:search, :fetch, :all_actions].each do |action|
98
+ day_graph = performance_for_day_graph(auth_name, action)
99
+ month_graph = performance_for_month_graph(auth_name, action)
100
+ year_graph = performance_for_year_graph(auth_name, action)
101
+ add_graphs(graphs, day_graph, month_graph, year_graph)
139
102
  end
103
+ end
140
104
 
141
- def performance_for_year_graph(auth_name, action)
142
- filepath = QaServer::PerformanceGraphingService.performance_graph_image_path(authority_name: auth_name, action: action, time_period: :year)
143
- exists = QaServer::PerformanceGraphingService.performance_graph_image_exists?(authority_name: auth_name, action: action, time_period: :year)
144
- {
145
- action: action,
146
- time_period: :year,
147
- graph: filepath,
148
- exists: exists,
149
- label: "Performance data for the last 12 months.",
150
- authority_name: auth_name,
151
- base_id: "performance-of-#{auth_name}"
152
- }
153
- end
105
+ # only add the graphs if all 3 exist
106
+ def add_graphs(graphs, day_graph, month_graph, year_graph)
107
+ return unless day_graph[:exists] && month_graph[:exists] && year_graph[:exists]
108
+ graphs << day_graph
109
+ graphs << month_graph
110
+ graphs << year_graph
111
+ end
112
+
113
+ def performance_for_day_graph(auth_name, action)
114
+ filepath = QaServer::PerformanceGraphingService.performance_graph_image_path(authority_name: auth_name, action: action, time_period: :day)
115
+ exists = QaServer::PerformanceGraphingService.performance_graph_image_exists?(authority_name: auth_name, action: action, time_period: :day)
116
+ {
117
+ action: action,
118
+ time_period: :day,
119
+ graph: filepath,
120
+ exists: exists,
121
+ label: "Performance data for the last 24 hours.",
122
+ authority_name: auth_name,
123
+ base_id: "performance-of-#{auth_name}"
124
+ }
125
+ end
126
+
127
+ def performance_for_month_graph(auth_name, action)
128
+ filepath = QaServer::PerformanceGraphingService.performance_graph_image_path(authority_name: auth_name, action: action, time_period: :month)
129
+ exists = QaServer::PerformanceGraphingService.performance_graph_image_exists?(authority_name: auth_name, action: action, time_period: :month)
130
+ {
131
+ action: action,
132
+ time_period: :month,
133
+ graph: filepath,
134
+ exists: exists,
135
+ label: "Performance data for the last 30 days.",
136
+ authority_name: auth_name,
137
+ base_id: "performance-of-#{auth_name}"
138
+ }
139
+ end
140
+
141
+ def performance_for_year_graph(auth_name, action)
142
+ filepath = QaServer::PerformanceGraphingService.performance_graph_image_path(authority_name: auth_name, action: action, time_period: :year)
143
+ exists = QaServer::PerformanceGraphingService.performance_graph_image_exists?(authority_name: auth_name, action: action, time_period: :year)
144
+ {
145
+ action: action,
146
+ time_period: :year,
147
+ graph: filepath,
148
+ exists: exists,
149
+ label: "Performance data for the last 12 months.",
150
+ authority_name: auth_name,
151
+ base_id: "performance-of-#{auth_name}"
152
+ }
153
+ end
154
154
  end
155
155
  end
@@ -4,10 +4,11 @@ module QaServer
4
4
  class CheckStatusPresenter
5
5
  # @param authorities_list [Array<String>] a list of all loaded authorities' names
6
6
  # @param status_data [Array<Hash>] a list of status data for each scenario tested
7
- def initialize(authorities_list:, connection_status_data:, accuracy_status_data:)
7
+ def initialize(authorities_list:, connection_status_data:, accuracy_status_data:, comparison_status_data:)
8
8
  @authorities_list = authorities_list
9
9
  @connection_status_data = connection_status_data
10
10
  @accuracy_status_data = accuracy_status_data
11
+ @comparison_status_data = comparison_status_data
11
12
  end
12
13
 
13
14
  # @return [Array<String>] A list of all loaded authorities' names
@@ -19,10 +20,10 @@ module QaServer
19
20
  # @example
20
21
  # [ { status: :PASS,
21
22
  # status_label: '√',
22
- # authority_name: 'LOCNAMES_LD4L_CACHE',
23
- # subauthority_name: 'person',
24
23
  # service: 'ld4l_cache',
25
24
  # action: 'search',
25
+ # authority_name: 'LOCNAMES_LD4L_CACHE',
26
+ # subauthority_name: 'person',
26
27
  # url: '/qa/search/linked_data/locnames_ld4l_cache/person?q=mark twain&maxRecords=4',
27
28
  # err_message: '' }, ... ]
28
29
  attr_reader :connection_status_data
@@ -33,10 +34,10 @@ module QaServer
33
34
  # @example
34
35
  # [ { status: :PASS,
35
36
  # status_label: '√',
36
- # authority_name: 'LOCNAMES_LD4L_CACHE',
37
- # subauthority_name: 'person',
38
37
  # service: 'ld4l_cache',
39
38
  # action: 'search',
39
+ # authority_name: 'LOCNAMES_LD4L_CACHE',
40
+ # subauthority_name: 'person',
40
41
  # expected: 10,
41
42
  # actual: 8,
42
43
  # url: '/qa/search/linked_data/locnames_ld4l_cache/person?q=mark twain&maxRecords=20',
@@ -44,6 +45,25 @@ module QaServer
44
45
  attr_reader :accuracy_status_data
45
46
  # rubocop:enable Style/AsciiComments
46
47
 
48
+ # rubocop:disable Style/AsciiComments
49
+ # @return [Array<Hash>] A list of status data for each comparison of accuracy scenarios tested.
50
+ # @example
51
+ # [ { status: [:PASS, :FAIL],
52
+ # status_label: ['√', 'X'],
53
+ # service: ['ld4l_cache', 'ld4l_cache'],
54
+ # action: 'search',
55
+ # authority_name: ['LOCNAMES_LD4L_CACHE', 'LOCNAMES_NEW_LD4L_CACHE']
56
+ # subauthority_name: 'imprint',
57
+ # request_data: 'Plantin'
58
+ # target: 'http://thesaurus.cerl.org/record/cni00007649',
59
+ # expected: [1, 1]
60
+ # actual: [1, 2]
61
+ # url: ['/qa/search/linked_data/cerl_ld4l_cache/imprint?q=Plantin&maxRecords=8',
62
+ # '/qa/search/linked_data/cerl_new_ld4l_cache/imprint?q=Plantin&maxRecords=8']
63
+ # err_message: ['',''] }, ... ]
64
+ attr_reader :comparison_status_data
65
+ # rubocop:enable Style/AsciiComments
66
+
47
67
  # @return [Boolean] true if status data exists; otherwise false
48
68
  def connection_status_data?
49
69
  @connection_status_data.present?
@@ -54,14 +74,19 @@ module QaServer
54
74
  @accuracy_status_data.present?
55
75
  end
56
76
 
77
+ # @return [Boolean] true if status data exists; otherwise false
78
+ def comparison_status_data?
79
+ @comparison_status_data.present?
80
+ end
81
+
57
82
  # @return [String] the name of the css style class to use for the status cell based on the status of the scenario test.
58
83
  def status_style_class(status)
59
- "status-#{status[:status]}"
84
+ "status-#{status}"
60
85
  end
61
86
 
62
87
  # @return [String] the name of the css style class to use for the status cell based on the status of the scenario test.
63
88
  def status_label(status)
64
- case status[:status]
89
+ case status
65
90
  when :good
66
91
  QaServer::ScenarioRunHistory::GOOD_MARKER
67
92
  when :bad
@@ -71,6 +96,17 @@ module QaServer
71
96
  end
72
97
  end
73
98
 
99
+ def selected_authority
100
+ return comparison_status_data.first[:authority_name][0].to_sym if comparison_status_data?
101
+ return connection_status_data.first[:authority_name].to_sym if connection_status_data?
102
+ return accuracy_status_data.first[:authority_name].to_sym if accuracy_status_data?
103
+ ""
104
+ end
105
+
106
+ def selected_comparison
107
+ comparison_status_data? ? comparison_status_data.first[:authority_name][1].to_sym : ""
108
+ end
109
+
74
110
  def value_all_collections
75
111
  QaServer::CheckStatusController::ALL_AUTHORITIES
76
112
  end
@@ -87,6 +123,10 @@ module QaServer
87
123
  "#{value_check_param}_#{value_check_connections}".downcase.to_sym
88
124
  end
89
125
 
126
+ def connection_tests_checked
127
+ connection_status_data?
128
+ end
129
+
90
130
  def value_check_accuracy
91
131
  QaServer::AuthorityValidationBehavior::VALIDATE_ACCURACY
92
132
  end
@@ -95,6 +135,22 @@ module QaServer
95
135
  "#{value_check_param}_#{value_check_accuracy}".downcase.to_sym
96
136
  end
97
137
 
138
+ def accuracy_tests_checked
139
+ accuracy_status_data?
140
+ end
141
+
142
+ def value_check_comparison
143
+ QaServer::AuthorityValidationBehavior::VALIDATE_ACCURACY_COMPARISON
144
+ end
145
+
146
+ def label_check_comparison
147
+ "#{value_check_param}_#{value_check_comparison}".downcase.to_sym
148
+ end
149
+
150
+ def comparison_tests_checked
151
+ comparison_status_data?
152
+ end
153
+
98
154
  def value_all_checks
99
155
  QaServer::AuthorityValidationBehavior::ALL_VALIDATIONS
100
156
  end