summaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-01-26 11:59:42 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-01-26 12:00:15 +0100
commitacbb9609fdfc8acbdd1bbec5e8ade31afa6f64eb (patch)
treedd5fcc079bfad3e1c1fb9f75c31d9cad1c398930 /sonar-server
parentb989d6432701e603f9f75f84d21e8f23cf3cb7e0 (diff)
downloadsonarqube-acbb9609fdfc8acbdd1bbec5e8ade31afa6f64eb.tar.gz
sonarqube-acbb9609fdfc8acbdd1bbec5e8ade31afa6f64eb.zip
SONAR-2138 Displaying differential values in % can be misleading
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb8
2 files changed, 7 insertions, 3 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
index 294710f5458..dd1f5bd385c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
@@ -494,7 +494,7 @@ module ApplicationHelper
if m
val=variation_value(m, options)
if val
- formatted_val=(val>=0 ? "+#{m.format_numeric_value(val)}" : m.format_numeric_value(val))
+ formatted_val=(val>=0 ? "+" : "") + m.format_numeric_value(val, :variation => true)
css_class=''
if options[:color]||true
css_class='var'
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb
index be2ca947203..1e553e99659 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb
@@ -88,7 +88,7 @@ class ProjectMeasure < ActiveRecord::Base
end
end
- def format_numeric_value(val)
+ def format_numeric_value(val, options={})
if metric.nil?
return val.to_s
end
@@ -99,7 +99,11 @@ class ProjectMeasure < ActiveRecord::Base
when Metric::VALUE_TYPE_FLOAT
number_with_precision(val, :precision => 1)
when Metric::VALUE_TYPE_PERCENT
- number_to_percentage(val, {:precision => 1})
+ if (options[:variation]==true)
+ number_with_precision(val, :precision => 1)
+ else
+ number_to_percentage(val, {:precision => 1})
+ end
when Metric::VALUE_TYPE_MILLISEC
millisecs_formatted_value(val)
else