Skip to content

Commit

Permalink
Short circuit call to get_default_format
Browse files Browse the repository at this point in the history
  • Loading branch information
isimluk committed Dec 16, 2016
1 parent 0f049ee commit e6b02b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/miq_report/formatting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def format(col, value, options = {})

# Use default format for column stil nil
if format.nil? || format == :_default_
expression_col = col_to_expression_col(col)
dt = self.class.get_col_type(expression_col)
dt = MiqExpression.get_col_type(col_to_expression_col(col))
dt = value.class.to_s.downcase.to_sym if dt.nil?
dt = dt.to_sym unless dt.nil?
format = FORMATS[self.class.get_default_format(expression_col, dt)]
sfx = col.to_s.split('__').last.try(:to_sym)
format = FORMATS[MiqReportFormats.default_format_for(col, sfx, dt)]
format = format.deep_clone if format # Make sure we don't taint the original
if format && MiqReportFormats::DEFAULTS_AND_OVERRIDES[:precision_by_column].key?(col.to_sym)
format[:precision] = MiqReportFormats::DEFAULTS_AND_OVERRIDES[:precision_by_column][col.to_sym]
Expand Down

0 comments on commit e6b02b5

Please sign in to comment.