]> source.dussan.org Git - sonarqube.git/commitdiff
fix TimeMachine webservice when metric is uncovered_lines or uncovered_conditions
authorsimonbrandhof <simon.brandhof@gmail.com>
Thu, 13 Jan 2011 00:02:52 +0000 (01:02 +0100)
committersimonbrandhof <simon.brandhof@gmail.com>
Thu, 13 Jan 2011 00:02:52 +0000 (01:02 +0100)
sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb

index 03caa8495f59bc244fdf8ba99c7d3ace8fecf99c..5f089e9e0115a6f77d3fd3436f52e313a79e1368 100644 (file)
@@ -172,12 +172,25 @@ class ProjectMeasure < ActiveRecord::Base
   end
 
   def typed_value
-    if text_value
+    case metric().val_type
+    when Metric::VALUE_TYPE_INT
+      value
+    when Metric::VALUE_TYPE_FLOAT
+      value
+    when Metric::VALUE_TYPE_PERCENT
+      value
+    when Metric::VALUE_TYPE_MILLISEC
+      value
+    when Metric::VALUE_TYPE_BOOLEAN
+      value
+    when Metric::VALUE_TYPE_LEVEL
+      text_value
+    when Metric::VALUE_TYPE_STRING
       text_value
-    elsif value
-      value.to_f
+    when Metric::VALUE_TYPE_RATING
+      text_value || value.to_i.to_s
     else
-      nil
+      text_value || value
     end
   end