]> source.dussan.org Git - sonarqube.git/commitdiff
Add formatted values on differential measures on /api/resources/index
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Jun 2014 08:11:16 +0000 (10:11 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Jun 2014 08:11:16 +0000 (10:11 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb

index 92ff867d2ba7a64339de5014f4c9f19ed0f92754..1bca9a153f12b4682689cf0e138fd0faba5378c1 100644 (file)
@@ -442,10 +442,15 @@ class Api::ResourcesController < Api::ApiController
             json_measure[:var]=measure.tendency
           end
           json_measure[:var1]=measure.variation_value_1.to_f if measure.variation_value_1
+          json_measure[:fvar1]=measure.format_numeric_value(measure.variation_value_1.to_f) if measure.variation_value_1
           json_measure[:var2]=measure.variation_value_2.to_f if measure.variation_value_2
+          json_measure[:fvar2]=measure.format_numeric_value(measure.variation_value_2.to_f) if measure.variation_value_2
           json_measure[:var3]=measure.variation_value_3.to_f if measure.variation_value_3
+          json_measure[:fvar3]=measure.format_numeric_value(measure.variation_value_3.to_f) if measure.variation_value_3
           json_measure[:var4]=measure.variation_value_4.to_f if measure.variation_value_4
+          json_measure[:fvar4]=measure.format_numeric_value(measure.variation_value_4.to_f) if measure.variation_value_4
           json_measure[:var5]=measure.variation_value_5.to_f if measure.variation_value_5
+          json_measure[:fvar5]=measure.format_numeric_value(measure.variation_value_5.to_f) if measure.variation_value_5
         end
         if measure.rule_id
           rule = rules_by_id[measure.rule_id]
@@ -528,10 +533,15 @@ class Api::ResourcesController < Api::ApiController
                 xml.var(measure.tendency)
               end
               xml.var1(measure.variation_value_1.to_f) if measure.variation_value_1
+              xml.fvar1(measure.format_numeric_value(measure.variation_value_1.to_f)) if measure.variation_value_1
               xml.var2(measure.variation_value_2.to_f) if measure.variation_value_2
+              xml.fvar2(measure.format_numeric_value(measure.variation_value_2.to_f)) if measure.variation_value_2
               xml.var3(measure.variation_value_3.to_f) if measure.variation_value_3
+              xml.fvar3(measure.format_numeric_value(measure.variation_value_3.to_f)) if measure.variation_value_3
               xml.var4(measure.variation_value_4.to_f) if measure.variation_value_4
+              xml.fvar4(measure.format_numeric_value(measure.variation_value_4.to_f)) if measure.variation_value_4
               xml.var5(measure.variation_value_5.to_f) if measure.variation_value_5
+              xml.fvar5(measure.format_numeric_value(measure.variation_value_5.to_f)) if measure.variation_value_5
             end
             if measure.rule_id
               rule = rules_by_id[measure.rule_id]