diff options
Diffstat (limited to 'sonar-server/src/main/webapp')
4 files changed, 21 insertions, 17 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/profiles_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/profiles_helper.rb index bfd0fbcb3c1..ad7044b24a8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/profiles_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/profiles_helper.rb @@ -23,7 +23,7 @@ module ProfilesHelper end def label_for_rules_count(profile) - label="#{profile.active_rules.count} rules" + label="#{profile.count_active_rules} rules" count_overriding=profile.count_overriding_rules if count_overriding>0 diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_parameter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_parameter.rb index 85904b4ace9..6b47d8fd407 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_parameter.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_parameter.rb @@ -18,23 +18,23 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
#
class ActiveRuleParameter < ActiveRecord::Base
- belongs_to :active_rule
- belongs_to :rules_parameter
+ belongs_to :active_rule
+ belongs_to :rules_parameter
- def name
- rules_parameter.name
- end
+ def name
+ rules_parameter.name
+ end
- def parameter
- rules_parameter
- end
+ def parameter
+ rules_parameter
+ end
- def validate_on_update
- rules_parameter.validate_value(value, errors, "value" )
- end
-
- def copy
- ActiveRuleParameter.new(:rules_parameter => rules_parameter, :value => value)
- end
+ def validate_on_update
+ rules_parameter.validate_value(value, errors, "value" )
+ end
+
+ def copy
+ ActiveRuleParameter.new(:rules_parameter => rules_parameter, :value => value)
+ end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb index 493a56da9e0..52e986162b4 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb @@ -126,6 +126,10 @@ class Profile < ActiveRecord::Base end end + def count_active_rules + active_rules.select{|ar| ar.rule.enabled}.size + end + def ancestors @ancestors ||= begin diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb index 0c75209fe57..48cb7947eb3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb @@ -86,7 +86,7 @@ <td><a href="<%= url_for :controller => 'rules_configuration', :action => 'index', :id => profile.id -%>" id="rules-<%= language.getKey() -%>-<%= u(profile.name) -%>"><%= h profile.name %></a></td> <td align="right"> - <span id="activated_rules_<%= u profile.key -%>"><%= profile.active_rules.count -%></span> + <span id="activated_rules_<%= u profile.key -%>"><%= profile.count_active_rules -%></span> </td> <td align="right"><span id="alerts_<%= u profile.key -%>"><%= profile.alerts.size -%></span></td> |