Class: IevkitViews::ValidationReport

Inherits:
Report
  • Object
show all
Defined in:
app/services/ievkit_views/validation_report.rb

Instance Attribute Summary

Attributes inherited from Report

#datas, #result, #search

Instance Method Summary collapse

Methods inherited from Report

#errors, #initialize, #search_for, #sort_datas, #sum_report, #sum_report_for_tests

Methods included from ApplicationHelper

#badge_count, #get_icon, #get_icon_title

Constructor Details

This class inherits a constructor from IevkitViews::Report

Instance Method Details

#check_pointsObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/services/ievkit_views/validation_report.rb', line 3

def check_points
  datas = []
  return datas unless @report && @report['check_points']
  @report['check_points'].each do |d|
    next unless d['test_id']
    severity =d['severity']&.downcase&.to_sym
    result = d['result']&.downcase&.to_sym
    status = if severity == :error && result == :nok
               :error
             elsif severity == :warning && result == :nok
               :warning
             elsif result == :uncheck
               :ignored
             else
               :ok
             end
    check_point_error_count = d['check_point_error_count'].to_i
    count_error = status == :error ? check_point_error_count : 0
    count_warning = status == :warning ? check_point_error_count : 0
    datas << {
      name: d['test_id'],
      type: d['type'],
      status: status,
      severity: severity,
      count_error: count_error,
      count_warning: count_warning,
      check_point_errors: d['errors']
    }.tap{ |hash|
      hash[:error_or_warning] = (hash[:count_error] + hash[:count_warning]) > 0
    }
  end
  sort_datas(datas)
end