aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2012-02-06 11:52:07 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2012-02-06 12:46:56 +0400
commit9718df462182f0dcb6d54af0609b6faea42eb699 (patch)
tree57564e747cc30288a9845a0d56f448df7d29368a
parentd7c4c773ed9b7774ee3c6c55ee232f6fd4aa2a5a (diff)
downloadsonarqube-9718df462182f0dcb6d54af0609b6faea42eb699.tar.gz
sonarqube-9718df462182f0dcb6d54af0609b6faea42eb699.zip
SONAR-3231 Allow to associate measure with committer
For now we should not show such measures in UI
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb3
-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.rb3
-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.rb2
-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.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap_builder.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/trends_chart.rb2
11 files changed, 16 insertions, 11 deletions
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 da454cf3488..5bd4492f3e3 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
@@ -96,7 +96,8 @@ class Api::ResourcesController < Api::ApiController
measures_order = "project_measures.value #{'DESC' if metrics.first.direction<0}"
end
end
-
+
+ measures_conditions << 'project_measures.committer 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 8888794b0b6..15eaea9188c 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']
+ 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_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 ac13b471b66..100e11962b0 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
@@ -105,7 +105,8 @@ class ComponentsController < ApplicationController
'metric_id' => mids,
'rule_id' => nil,
'rule_priority' => nil,
- 'characteristic_id' => nil}))
+ 'characteristic_id' => nil,
+ 'committer' => 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 3526f8c3850..afe14e3e89a 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})
+ measures=ProjectMeasure.find(:all, :conditions => {:rule_id => nil, :rule_priority => nil, :snapshot_id => @sids, :characteristic_id => nil, :committer => 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 b84b3c4c20e..f40ff1a93b8 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?)
+ return item if (item && metric && item.metric_id==metric.id && item.rule_priority.nil? && item.characteristic_id.nil? && item.committer.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 38b34668c0f..c198930fe3c 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
@@ -91,6 +91,8 @@ class DrilldownColumn
conditions += ' AND project_measures.characteristic_id IS NULL'
end
+ conditions += ' AND project_measures.committer IS NULL'
+
@measures=ProjectMeasure.find(:all,
:select => "project_measures.id,project_measures.metric_id,project_measures.#{value_column},project_measures.text_value,project_measures.alert_status,project_measures.alert_text,project_measures.snapshot_id",
:joins => :snapshot,
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 11f94611749..4fe3bf196d6 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
@@ -56,7 +56,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 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 committer 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 b0144926048..3b75256abfd 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,6 +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' +
' 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 30651d914f6..e840b1665e3 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,9 +27,9 @@ 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'
- has_many :rulemeasures, :class_name => 'ProjectMeasure', :conditions => 'rule_id IS NOT NULL AND characteristic_id IS NULL', :include => 'rule'
- has_many :characteristic_measures, :class_name => 'ProjectMeasure', :conditions => 'rule_id IS NULL AND characteristic_id IS NOT NULL'
+ 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 :events, :dependent => :destroy, :order => 'event_date DESC'
has_one :source, :class_name => 'SnapshotSource', :dependent => :destroy
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap_builder.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap_builder.rb
index ec1fdf46812..6ec0a08b225 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap_builder.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap_builder.rb
@@ -46,7 +46,7 @@ class Sonar::TreemapBuilder
# temporary fix for SONAR-1098
snapshots=snapshots[0...999]
measures = ProjectMeasure.find(:all,
- :conditions => ['characteristic_id IS NULL and rule_id IS NULL and rule_priority IS NULL and metric_id IN (?) and snapshot_id IN (?)',
+ :conditions => ['committer IS NULL and characteristic_id IS NULL and rule_id IS NULL and rule_priority IS NULL and metric_id IN (?) and snapshot_id IN (?)',
[size_metric.id, color_metric.id], snapshots.map{|s| s.id}])
end
Sonar::Treemap.new(measures_hash_by_snapshot(snapshots, measures), width, height, size_metric, color_metric)
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 a903ef5d5d7..2893d2bc46e 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.rule_priority is null and m.characteristic_id is null and m.committer is null"
if (options[:from])
sql += ' and s.created_at>=?'
end