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,18 +43,14 @@ 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)
|
||||
end
|
||||
result[group] ||= []
|
||||
result[group] += values.map { |value| parse_number(value)}
|
||||
end
|
||||
min_max_data = prepared_data.transform_values do |columns|
|
||||
columns.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
|
||||
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
|
||||
elsif type_data == 'comparsion'
|
||||
prepared_data = filtered_data.each_with_object({}) do |((_, code), values), result|
|
||||
|
||||
Reference in New Issue
Block a user