From f92b8ebe2ecb7073ee89cdc417a53ffba40285b5 Mon Sep 17 00:00:00 2001 From: Libor Pichler Date: Fri, 17 May 2019 16:07:42 +0200 Subject: [PATCH] Remove method get_col_type from MiqReport (and its usages) --- app/models/miq_report.rb | 6 +----- app/models/miq_report/generator.rb | 2 +- app/models/miq_report/generator/sorting.rb | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/models/miq_report.rb b/app/models/miq_report.rb index 5bc90dbbc72..dc28bcf774e 100644 --- a/app/models/miq_report.rb +++ b/app/models/miq_report.rb @@ -123,12 +123,8 @@ def self.get_expressions_by_model(db) reports.each_with_object({}) { |report, hash| hash[report.name] = report.id } end - def self.get_col_type(path) - MiqExpression.get_col_type(path) - end - def self.get_col_info(path) - data_type = get_col_type(path) + data_type = parse_field_or_tag(path).try(:column_type) { :data_type => data_type, :available_formats => get_available_formats(path, data_type), diff --git a/app/models/miq_report/generator.rb b/app/models/miq_report/generator.rb index 42c8a5742e5..b6ea8bd7338 100644 --- a/app/models/miq_report/generator.rb +++ b/app/models/miq_report/generator.rb @@ -28,7 +28,7 @@ def date_time_break_suffixes end def get_col_break_suffixes(col) - col_type = get_col_type(col) + col_type = MiqExpression.parse_field_or_tag(col).try(:column_type) case col_type when :date date_time_break_suffixes.select { |_name, suffix| !suffix.to_s.starts_with?("hour") } diff --git a/app/models/miq_report/generator/sorting.rb b/app/models/miq_report/generator/sorting.rb index b5dd934d17d..d3516c2970c 100644 --- a/app/models/miq_report/generator/sorting.rb +++ b/app/models/miq_report/generator/sorting.rb @@ -15,7 +15,7 @@ def build_sort_table sb_nil_sub = [] new_sortby.each_with_index do |sb, idx| base_col_name = sb.split(SORT_COL_SUFFIX).first - ctype = self.class.get_col_type(col_to_expression_col(base_col_name)) || :string + ctype = MiqExpression.parse_field_or_tag(col_to_expression_col(base_col_name)) || :string sb_nil_sub[idx] = case ctype when :string, :text, :boolean then "00ff".hex.chr # "\xFF" when :integer, :fixnum, :decimal, :float then @table.data.collect { |d| d.data[sb] }.compact.max.to_i + 1