Browse Source

ruby api : add the methods QualityModel.characteristics_without_rule and QualityModel.characteristic()

tags/2.6
simonbrandhof 13 years ago
parent
commit
60ec8a88c1
1 changed files with 20 additions and 1 deletions
  1. 20
    1
      sonar-server/src/main/webapp/WEB-INF/app/models/quality_model.rb

+ 20
- 1
sonar-server/src/main/webapp/WEB-INF/app/models/quality_model.rb View File

@@ -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

Loading…
Cancel
Save