diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-20 14:27:01 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-20 14:27:01 +0000 |
commit | 60ec8a88c132929d298053ba4ef6268b991713a8 (patch) | |
tree | db6fbe027b34096335c279b5274ec2b452e11a31 /sonar-server | |
parent | bb32902cf66508fbdf2e3991fba329f557b5de4c (diff) | |
download | sonarqube-60ec8a88c132929d298053ba4ef6268b991713a8.tar.gz sonarqube-60ec8a88c132929d298053ba4ef6268b991713a8.zip |
ruby api : add the methods QualityModel.characteristics_without_rule and QualityModel.characteristic()
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/models/quality_model.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/quality_model.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/quality_model.rb index 66bba60d12c..d3f19856a57 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/quality_model.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/quality_model.rb @@ -37,8 +37,27 @@ class QualityModel < ActiveRecord::Base @characteristics_with_rule ||= begin characteristics.select do |c| - c.rule + !c.rule_id.nil? end end end + + def characteristics_without_rule + @characteristics_without_rule ||= + begin + characteristics.select do |c| + c.rule_id.nil? + end + end + end + + def characteristic(id) + @characteristics_by_id ||= + begin + hash={} + characteristics.each {|c| hash[c.id]=c} + hash + end + @characteristics_by_id[id] + end end
\ No newline at end of file |