From: Fabrice Bellingard Date: Fri, 22 Jun 2012 13:14:43 +0000 (+0200) Subject: SONAR-3556 Display only 1 decimal for floats in the Timeline widget X-Git-Tag: 3.2~294 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=209d68a71e8101353d4cc41a8c701aa976e480e2;p=sonarqube.git SONAR-3556 Display only 1 decimal for floats in the Timeline widget => To be consistent with everywhere else in Sonar --- 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 += ","