aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-01-13 01:02:52 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-01-13 01:02:52 +0100
commit21813ecff40f1df35977c0355a84e85c8734afca (patch)
treeb1044576e979e7cd7c79637474bec04d6643fcef
parent01dd87a3ee2cd4d8fcdbcd398e3c78f1334e64a7 (diff)
downloadsonarqube-21813ecff40f1df35977c0355a84e85c8734afca.tar.gz
sonarqube-21813ecff40f1df35977c0355a84e85c8734afca.zip
fix TimeMachine webservice when metric is uncovered_lines or uncovered_conditions
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb21
1 files changed, 17 insertions, 4 deletions
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 03caa8495f5..5f089e9e011 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
@@ -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