aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-02-15 13:50:01 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-02-15 13:50:01 +0100
commit6b67f3c2ac1a2078a2eceba647f328fd47f3f568 (patch)
treede5721e9181f8e7e8d69a8880cb6ffb2447aadf0 /sonar-server
parent364850c6ee27e86a6a788a6d7bf5c889ca7bf55a (diff)
downloadsonarqube-6b67f3c2ac1a2078a2eceba647f328fd47f3f568.tar.gz
sonarqube-6b67f3c2ac1a2078a2eceba647f328fd47f3f568.zip
SONAR-3208 use PERSON_ID instead of COMMITTER in PROJECT_MEASURES and RULE_FAILURES
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/components_helper.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/project.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb14
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/trends_chart.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/256_add_measures_person.rb (renamed from sonar-server/src/main/webapp/WEB-INF/db/migrate/256_add_measures_committer.rb)4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/263_replace_rule_failures_committer_by_person.rb31
13 files changed, 51 insertions, 20 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java b/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java
index 6dba0c4fa01..11c44f424e6 100644
--- a/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java
+++ b/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java
@@ -149,7 +149,7 @@ public class FilterExecutor implements ServerComponent {
}
sql.append(" pm.rule_id IS NULL AND pm.rule_priority IS NULL");
sql.append(" AND pm.characteristic_id IS NULL");
- sql.append(" AND pm.committer IS NULL");
+ sql.append(" AND pm.person_id IS NULL");
sql.append(" AND ");
}
sql.append(" s.status=:status AND s.islast=:islast ");
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb
index 5bd4492f3e3..c250dd6cc94 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb
@@ -97,7 +97,7 @@ class Api::ResourcesController < Api::ApiController
end
end
- measures_conditions << 'project_measures.committer IS NULL'
+ measures_conditions << 'project_measures.person_id IS NULL'
add_rule_filters(measures_conditions, measures_values)
add_characteristic_filters(measures_conditions, measures_values)
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb
index 15eaea9188c..09ea92f6d6c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb
@@ -73,7 +73,7 @@ class Api::TimemachineController < Api::ApiController
@measures_by_sid={}
unless @metrics.empty?
- sql_conditions = ['snapshots.project_id=:rid AND snapshots.status=:status AND project_measures.rules_category_id IS NULL AND project_measures.rule_id IS NULL AND project_measures.rule_priority IS NULL AND project_measures.committer IS NULL']
+ sql_conditions = ['snapshots.project_id=:rid AND snapshots.status=:status AND project_measures.rules_category_id IS NULL AND project_measures.rule_id IS NULL AND project_measures.rule_priority IS NULL AND project_measures.person_id IS NULL']
sql_values = {:rid => @resource.id, :status => Snapshot::STATUS_PROCESSED}
if params[:fromDateTime]
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb
index 30d5cab8b47..92c1b0bb427 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb
@@ -99,7 +99,7 @@ class ComponentsController < ApplicationController
'rule_id' => nil,
'rule_priority' => nil,
'characteristic_id' => nil,
- 'committer' => nil}))
+ 'person_id' => nil}))
end
measures
else
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb
index afe14e3e89a..0fa2ae57dad 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb
@@ -53,7 +53,7 @@ class TimemachineController < ApplicationController
snapshot_by_id[s.id]=s
end
- measures=ProjectMeasure.find(:all, :conditions => {:rule_id => nil, :rule_priority => nil, :snapshot_id => @sids, :characteristic_id => nil, :committer => nil})
+ measures=ProjectMeasure.find(:all, :conditions => {:rule_id => nil, :rule_priority => nil, :snapshot_id => @sids, :characteristic_id => nil, :person_id => nil})
rows_by_metric_id={}
@rows=[]
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/components_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/components_helper.rb
index f40ff1a93b8..0e9a8f5e5b0 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/components_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/components_helper.rb
@@ -67,7 +67,7 @@ module ComponentsHelper
return nil if items.nil?
items.each do |item|
metric = Metric.by_name(metric_name)
- return item if (item && metric && item.metric_id==metric.id && item.rule_priority.nil? && item.characteristic_id.nil? && item.committer.nil?)
+ return item if (item && metric && item.metric_id==metric.id && item.rule_priority.nil? && item.characteristic_id.nil? && item.person_id.nil?)
end
nil
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb
index 55bebdb4a2c..e9c14fce882 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb
@@ -92,10 +92,10 @@ class DrilldownColumn
end
if options[:committer]
- conditions += ' AND project_measures.committer=:committer'
+ conditions += ' AND project_measures.person_id=:committer'
condition_values[:committer]=options[:committer]
else
- conditions += ' AND project_measures.committer IS NULL'
+ conditions += ' AND project_measures.person_id IS NULL'
end
@measures=ProjectMeasure.find(:all,
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb
index b272ec46372..bc7b8524922 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb
@@ -55,7 +55,7 @@
# load measures
#
if @metric_ids.size>0
- measures=ProjectMeasure.find(:all, :conditions => ['rule_priority is null and rule_id is null and characteristic_id is null and committer is null and snapshot_id in (?)', @page_sids])
+ measures=ProjectMeasure.find(:all, :conditions => ['rule_priority is null and rule_id is null and characteristic_id is null and person_id is null and snapshot_id in (?)', @page_sids])
measures.each do |m|
snapshot=@snapshots_by_id[m.snapshot_id]
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
index 3b75256abfd..14c9c288ec4 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
@@ -100,7 +100,7 @@ class Project < ActiveRecord::Base
" s.status='%s' and " +
' s.project_id=%s and m.metric_id=%s ', Snapshot::STATUS_PROCESSED, self.id, metric_id]) +
' and m.rule_id IS NULL and m.rule_priority IS NULL' +
- ' and m.committer IS NULL' +
+ ' and m.person_id IS NULL' +
' order by s.created_at'
create_chart_measures(Project.connection.select_all(sql), 'created_at', 'value')
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb
index 872efacc480..9742751a355 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb
@@ -27,10 +27,10 @@ class Snapshot < ActiveRecord::Base
belongs_to :root_snapshot, :class_name => 'Snapshot', :foreign_key => 'root_snapshot_id'
belongs_to :characteristic
- has_many :measures, :class_name => 'ProjectMeasure', :conditions => 'rule_id IS NULL AND characteristic_id IS NULL AND committer IS NULL'
- has_many :rulemeasures, :class_name => 'ProjectMeasure', :conditions => 'rule_id IS NOT NULL AND characteristic_id IS NULL AND committer IS NULL', :include => 'rule'
- has_many :characteristic_measures, :class_name => 'ProjectMeasure', :conditions => 'rule_id IS NULL AND characteristic_id IS NOT NULL AND committer IS NULL'
- has_many :committer_measures, :class_name => 'ProjectMeasure', :conditions => 'rule_id IS NULL AND characteristic_id IS NULL AND committer IS NOT NULL'
+ has_many :measures, :class_name => 'ProjectMeasure', :conditions => 'rule_id IS NULL AND characteristic_id IS NULL AND person_id IS NULL'
+ has_many :rulemeasures, :class_name => 'ProjectMeasure', :conditions => 'rule_id IS NOT NULL AND characteristic_id IS NULL AND person_id IS NULL', :include => 'rule'
+ has_many :characteristic_measures, :class_name => 'ProjectMeasure', :conditions => 'rule_id IS NULL AND characteristic_id IS NOT NULL AND person_id IS NULL'
+ has_many :person_measures, :class_name => 'ProjectMeasure', :conditions => 'rule_id IS NULL AND characteristic_id IS NULL AND person_id IS NOT NULL'
has_many :events, :dependent => :destroy, :order => 'event_date DESC'
has_one :source, :class_name => 'SnapshotSource', :dependent => :destroy
@@ -164,9 +164,9 @@ class Snapshot < ActiveRecord::Base
metric ? measures_hash[metric.id] : nil
end
- def committer_measure(metric, committer)
- committer_measures.each do |m|
- return m if m.metric_id==metric.id && m.committer==committer
+ def person_measure(metric, person_id)
+ person_measures.each do |m|
+ return m if m.metric_id==metric.id && m.person_id==person_id
end
nil
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/trends_chart.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/trends_chart.rb
index 2893d2bc46e..0780d64a390 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/trends_chart.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/trends_chart.rb
@@ -47,7 +47,7 @@ class TrendsChart
" and s.status=? " +
" and s.project_id=? " +
" and m.metric_id in (?) " +
- " and m.rule_priority is null and m.characteristic_id is null and m.committer is null"
+ " and m.rule_priority is null and m.characteristic_id is null and m.person_id is null"
if (options[:from])
sql += ' and s.created_at>=?'
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/256_add_measures_committer.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/256_add_measures_person.rb
index c15f450e7b4..88df6ccc464 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/256_add_measures_committer.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/256_add_measures_person.rb
@@ -21,10 +21,10 @@
#
# Sonar 2.14
#
-class AddMeasuresCommitter < ActiveRecord::Migration
+class AddMeasuresPerson < ActiveRecord::Migration
def self.up
- add_column 'project_measures', 'committer', :string, :null => true, :limit => 100
+ add_column 'project_measures', 'person_id', :integer, :null => true
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/263_replace_rule_failures_committer_by_person.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/263_replace_rule_failures_committer_by_person.rb
new file mode 100644
index 00000000000..f14d99d4ac5
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/263_replace_rule_failures_committer_by_person.rb
@@ -0,0 +1,31 @@
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2012 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+
+#
+# Sonar 2.14
+#
+class ReplaceRuleFailuresCommitterByPerson < ActiveRecord::Migration
+
+ def self.up
+ remove_column 'rule_failures', 'committer'
+ add_column 'rule_failures', 'person_id', :integer, :null => true
+ end
+
+end