From 209d68a71e8101353d4cc41a8c701aa976e480e2 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Fri, 22 Jun 2012 15:14:43 +0200 Subject: [PATCH] SONAR-3556 Display only 1 decimal for floats in the Timeline widget => To be consistent with everywhere else in Sonar --- .../org/sonar/plugins/core/widgets/timeline.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb index cdfe4275d32..a756e495f97 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb @@ -40,7 +40,7 @@ end metric_data_map[trend_item["metric_id"].to_i] << {:date => trend_item["created_at"], :value => trend_item["value"], :sid => trend_item["sid"]} end - + # Create JS structures to print out in the HTML page js_data = "[" js_snapshots = "[" @@ -57,7 +57,7 @@ # Only Oracle returns a Time object, so let's parse this string if it's not a Time instance m_date = Time.parse(metric_data[:date]) unless m_date.is_a? Time m_value = sprintf("%0.02f", metric_data[:value]) - m_value_localized = (m_value.end_with? '.00') ? number_with_precision(metric_data[:value], :precision => 0).to_s : number_with_precision(metric_data[:value], :precision => 2).to_s + m_value_localized = (m_value.end_with? '.00') ? number_with_precision(metric_data[:value], :precision => 0).to_s : number_with_precision(metric_data[:value], :precision => 1).to_s js_data += "{x:d(" js_data += m_date.year.to_s js_data += "," -- 2.39.5