SU2-33 | Изменена логика раскраски
This commit is contained in:
@@ -4,8 +4,8 @@ module OrganisationsHelper
|
||||
return nil if code.nil? || code.size < 2
|
||||
prefix = code[0, 2]
|
||||
case prefix
|
||||
when '21', '22', '23', '24'
|
||||
'21-24'
|
||||
when '21', '22', '23', '24', '25'
|
||||
'21-25'
|
||||
else
|
||||
prefix
|
||||
end
|
||||
@@ -16,8 +16,8 @@ module OrganisationsHelper
|
||||
prefix = code[0, 2]
|
||||
return false unless prefix.match?(/\A\d{2}\z/)
|
||||
if type_data == 'min_max'
|
||||
return false if %w[16 17].include?(prefix)
|
||||
return true if %w[21 22 23 24 25 29].include?(prefix)
|
||||
return false if %w[16 17 29].include?(prefix) || prefix.start_with?("3")
|
||||
return true if %w[21 22 23 24 25].include?(prefix)
|
||||
return !code.end_with?('00')
|
||||
elsif type_data == 'comparsion'
|
||||
return code.end_with?('00')
|
||||
@@ -43,19 +43,15 @@ module OrganisationsHelper
|
||||
prepared_data = filtered_data.each_with_object({}) do |((_, code), values), result|
|
||||
next if code.nil? || !keep_code?(code)
|
||||
group = group_key(code)
|
||||
result[group] ||= Hash.new { |h, k| h[k] = [] }
|
||||
values.each_with_index do |value, index|
|
||||
result[group][index + 1] << parse_number(value)
|
||||
result[group] ||= []
|
||||
result[group] += values.map { |value| parse_number(value)}
|
||||
end
|
||||
end
|
||||
min_max_data = prepared_data.transform_values do |columns|
|
||||
columns.transform_values do |values|
|
||||
min_max_data = prepared_data.transform_values do |values|
|
||||
sorted = values.sort
|
||||
size = sorted.size
|
||||
p50 = size.odd? ? sorted[size / 2] : (sorted[size / 2 - 1] + sorted[size / 2]) / 2.0
|
||||
{ min: sorted.first, p50: p50, max: sorted.last }
|
||||
end
|
||||
end
|
||||
elsif type_data == 'comparsion'
|
||||
prepared_data = filtered_data.each_with_object({}) do |((_, code), values), result|
|
||||
next if code.nil? || !keep_code?(code, type_data: 'comparsion')
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
- @current_doc_info1[key].each_with_index do |value, index|
|
||||
- key_group = key[1].nil? ? nil : group_key(key[1])
|
||||
- if min_max_data.has_key?(key_group) && keep_code?(key[1])
|
||||
- min_value = min_max_data[key_group][index + 1][:min]
|
||||
- max_value = min_max_data[key_group][index + 1][:max]
|
||||
- p50 = min_max_data[key_group][index + 1][:p50]
|
||||
- min_value = min_max_data[key_group][:min]
|
||||
- max_value = min_max_data[key_group][:max]
|
||||
- p50 = min_max_data[key_group][:p50]
|
||||
- color = get_color_for_cell(value, min: min_value, median: p50, max: max_value)
|
||||
td style="background-color: #{color}" = value
|
||||
- elsif comparsion_data.has_key?(key[1]) && keep_code?(key[1], type_data: 'comparsion')
|
||||
|
||||
Reference in New Issue
Block a user