diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-06 14:12:57 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-06 14:12:57 +0000 |
commit | c5749a967563442994ab3183c7ecc13fa4e6b1f1 (patch) | |
tree | 643a4701c039569cd7fc823f3e697d8a388c5175 /sonar-server | |
parent | ca79bd72bc11d542a33a3f92e3d9dda54a0c8477 (diff) | |
download | sonarqube-c5749a967563442994ab3183c7ecc13fa4e6b1f1.tar.gz sonarqube-c5749a967563442994ab3183c7ecc13fa4e6b1f1.zip |
SONAR-249 add 2 periods for variation values + rename SNAPSHOT.VAR_xxx columns + fix saving of dependencies
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb | 2 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb | 4 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb | 10 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/db/migrate/161_add_snapshots_variation_columns.rb | 43 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/db/migrate/162_delete_iso_rule_categories.rb | 1 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/db/migrate/163_add_measure_variation_values.rb (renamed from sonar-server/src/main/webapp/WEB-INF/db/migrate/161_add_snapshots_var_columns.rb) | 14 | ||||
-rw-r--r-- | sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/measures.xml | 14 | ||||
-rw-r--r-- | sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/shared.xml | 8 | ||||
-rw-r--r-- | sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/views.xml | 8 |
9 files changed, 74 insertions, 30 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 80da25d2f0c..a0d49e16773 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 @@ -201,7 +201,7 @@ class Api::ResourcesController < Api::ApiController def select_columns_for_measures select_columns='project_measures.id,project_measures.value,project_measures.metric_id,project_measures.snapshot_id,project_measures.rule_id,project_measures.rule_priority,project_measures.text_value,project_measures.characteristic_id' if params[:includetrends]=='true' - select_columns+=',project_measures.tendency,project_measures.diff_value_1,project_measures.diff_value_2,project_measures.diff_value_3' + select_columns+=',project_measures.tendency,project_measures.variation_value_1,project_measures.variation_value_2,project_measures.variation_value_3,project_measures.variation_value_4,project_measures.variation_value_5' end if params[:includealerts]=='true' select_columns+=',project_measures.alert_status,project_measures.alert_text' diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb index c72240dcfc2..d5e095c22ba 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb @@ -30,8 +30,8 @@ module DashboardHelper def variation_select_option(snapshot, index) return nil if snapshot.nil? || snapshot.project_snapshot.nil? - mode=snapshot.project_snapshot.send "var_mode_#{index}" - mode_param=snapshot.project_snapshot.send "var_label_#{index}" + mode=snapshot.project_snapshot.send "variation_mode_#{index}" + mode_param=snapshot.project_snapshot.send "variation_param_#{index}" if mode if mode=='days' diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb index 8e08ab98147..13768dcbeba 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb @@ -111,11 +111,15 @@ class ProjectMeasure < ActiveRecord::Base result = nil case variation_index when 1 - result=diff_value_1 + result=variation_value_1 when 2 - result=diff_value_2 + result=variation_value_2 when 3 - result=diff_value_3 + result=variation_value_3 + when 4 + result=variation_value_4 + when 5 + result=variation_value_5 end result end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/161_add_snapshots_variation_columns.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/161_add_snapshots_variation_columns.rb new file mode 100644 index 00000000000..fa4760c9c69 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/161_add_snapshots_variation_columns.rb @@ -0,0 +1,43 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2009 SonarSource SA +# 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.5 +# +class AddSnapshotsVariationColumns < ActiveRecord::Migration + + def self.up + add_column :snapshots, :variation_mode_1, :string, :null => true, :limit => 100 + add_column :snapshots, :variation_param_1, :string, :null => true, :limit => 100 + + add_column :snapshots, :variation_mode_2, :string, :null => true, :limit => 100 + add_column :snapshots, :variation_param_2, :string, :null => true, :limit => 100 + + add_column :snapshots, :variation_mode_3, :string, :null => true, :limit => 100 + add_column :snapshots, :variation_param_3, :string, :null => true, :limit => 100 + + add_column :snapshots, :variation_mode_4, :string, :null => true, :limit => 100 + add_column :snapshots, :variation_param_4, :string, :null => true, :limit => 100 + + add_column :snapshots, :variation_mode_5, :string, :null => true, :limit => 100 + add_column :snapshots, :variation_param_5, :string, :null => true, :limit => 100 + end + +end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/162_delete_iso_rule_categories.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/162_delete_iso_rule_categories.rb index 413b26a437d..f4253c74b59 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/162_delete_iso_rule_categories.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/162_delete_iso_rule_categories.rb @@ -23,7 +23,6 @@ # class DeleteIsoRuleCategories < ActiveRecord::Migration - def self.up remove_rule_categories delete_measures_on_iso_category diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/161_add_snapshots_var_columns.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/163_add_measure_variation_values.rb index 7c18dd8ad0f..1edc362fe87 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/161_add_snapshots_var_columns.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/163_add_measure_variation_values.rb @@ -21,16 +21,14 @@ # # Sonar 2.5 # -class AddSnapshotsVarColumns < ActiveRecord::Migration +class AddMeasureVariationValues < ActiveRecord::Migration def self.up - add_column :snapshots, :var_mode_1, :string, :null => true, :limit => 100 - add_column :snapshots, :var_mode_2, :string, :null => true, :limit => 100 - add_column :snapshots, :var_mode_3, :string, :null => true, :limit => 100 - - add_column :snapshots, :var_label_1, :string, :null => true, :limit => 100 - add_column :snapshots, :var_label_2, :string, :null => true, :limit => 100 - add_column :snapshots, :var_label_3, :string, :null => true, :limit => 100 + rename_column :project_measures, :diff_value_1, :variation_value_1 + rename_column :project_measures, :diff_value_2, :variation_value_2 + rename_column :project_measures, :diff_value_3, :variation_value_3 + add_column(:project_measures, :variation_value_4, :decimal, :null => true, :precision => 30, :scale => 20) + add_column(:project_measures, :variation_value_5, :decimal, :null => true, :precision => 30, :scale => 20) end end diff --git a/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/measures.xml b/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/measures.xml index d659395299e..f226e5028fa 100644 --- a/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/measures.xml +++ b/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/measures.xml @@ -22,12 +22,12 @@ description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]"/> - <snapshots var_mode_1="[null]" var_label_1="[null]" var_mode_2="[null]" var_label_2="[null]" var_mode_3="[null]" var_label_3="[null]" id="5" created_at="2008-12-25 01:00:01.00" version="1.0" project_id="4" scope="FIL" qualifier="CLA" + <snapshots variation_mode_1="[null]" variation_param_1="[null]" variation_mode_2="[null]" variation_param_2="[null]" variation_mode_3="[null]" variation_param_3="[null]" variation_mode_4="[null]" variation_param_4="[null]" variation_mode_5="[null]" variation_param_5="[null]" id="5" created_at="2008-12-25 01:00:01.00" version="1.0" project_id="4" scope="FIL" qualifier="CLA" root_project_id="1" root_snapshot_id="2" parent_snapshot_id="4" STATUS="P" ISLAST="true" path="2.4." depth="2"/> - <snapshots var_mode_1="[null]" var_label_1="[null]" var_mode_2="[null]" var_label_2="[null]" var_mode_3="[null]" var_label_3="[null]" id="6" created_at="2008-12-25 01:00:01.00" version="1.0" project_id="5" scope="FIL" qualifier="CLA" + <snapshots variation_mode_1="[null]" variation_param_1="[null]" variation_mode_2="[null]" variation_param_2="[null]" variation_mode_3="[null]" variation_param_3="[null]" variation_mode_4="[null]" variation_param_4="[null]" variation_mode_5="[null]" variation_param_5="[null]" id="6" created_at="2008-12-25 01:00:01.00" version="1.0" project_id="5" scope="FIL" qualifier="CLA" root_project_id="1" root_snapshot_id="2" parent_snapshot_id="4" STATUS="P" ISLAST="true" path="2.4." depth="2"/> @@ -35,13 +35,13 @@ <!-- SNAPSHOT 5 : 500 lines and coverage 80.5% --> <project_measures characteristic_id="[null]" id="1" metric_id="1" value="500" snapshot_id="5" - url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" + url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]" RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" alert_status="[null]" description="[null]"/> <project_measures characteristic_id="[null]" id="2" metric_id="2" value="80.5" snapshot_id="5" - url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" + url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]" RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" alert_status="[null]" description="[null]"/> @@ -49,19 +49,19 @@ <!-- SNAPSHOT 6 : 30 lines, coverage 20.6% and 10 duplicated lines --> <project_measures characteristic_id="[null]" id="3" metric_id="1" value="30" snapshot_id="6" - url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" + url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]" RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" alert_status="[null]" description="[null]"/> <project_measures characteristic_id="[null]" id="4" metric_id="2" value="20.6" snapshot_id="6" - url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" + url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]" RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" alert_status="[null]" description="[null]"/> <project_measures characteristic_id="[null]" id="5" metric_id="3" value="10" snapshot_id="6" - url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" + url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]" RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" alert_status="[null]" description="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/shared.xml b/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/shared.xml index 7c6f523c14a..b20c415ed47 100644 --- a/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/shared.xml +++ b/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/shared.xml @@ -13,24 +13,24 @@ <!-- Java project --> - <snapshots var_mode_1="[null]" var_label_1="[null]" var_mode_2="[null]" var_label_2="[null]" var_mode_3="[null]" var_label_3="[null]" id="1" created_at="2008-12-20 00:00:00.00" version="1.0" project_id="1" scope="PRJ" qualifier="TRK" + <snapshots variation_mode_1="[null]" variation_param_1="[null]" variation_mode_2="[null]" variation_param_2="[null]" variation_mode_3="[null]" variation_param_3="[null]" variation_mode_4="[null]" variation_param_4="[null]" variation_mode_5="[null]" variation_param_5="[null]" id="1" created_at="2008-12-20 00:00:00.00" version="1.0" project_id="1" scope="PRJ" qualifier="TRK" root_project_id="1" root_snapshot_id="[null]" parent_snapshot_id="[null]" STATUS="P" ISLAST="false" path="" depth="0"/> - <snapshots var_mode_1="[null]" var_label_1="[null]" var_mode_2="[null]" var_label_2="[null]" var_mode_3="[null]" var_label_3="[null]" id="2" created_at="2008-12-25 01:00:00.00" version="1.0" project_id="1" scope="PRJ" qualifier="TRK" + <snapshots variation_mode_1="[null]" variation_param_1="[null]" variation_mode_2="[null]" variation_param_2="[null]" variation_mode_3="[null]" variation_param_3="[null]" variation_mode_4="[null]" variation_param_4="[null]" variation_mode_5="[null]" variation_param_5="[null]" id="2" created_at="2008-12-25 01:00:00.00" version="1.0" project_id="1" scope="PRJ" qualifier="TRK" root_project_id="1" root_snapshot_id="[null]" parent_snapshot_id="[null]" STATUS="P" ISLAST="true" path="" depth="0"/> <!-- PHP project --> - <snapshots var_mode_1="[null]" var_label_1="[null]" var_mode_2="[null]" var_label_2="[null]" var_mode_3="[null]" var_label_3="[null]" id="3" created_at="2008-12-31 02:00:00.00" version="1.0" project_id="2" scope="PRJ" qualifier="TRK" + <snapshots variation_mode_1="[null]" variation_param_1="[null]" variation_mode_2="[null]" variation_param_2="[null]" variation_mode_3="[null]" variation_param_3="[null]" variation_mode_4="[null]" variation_param_4="[null]" variation_mode_5="[null]" variation_param_5="[null]" id="3" created_at="2008-12-31 02:00:00.00" version="1.0" project_id="2" scope="PRJ" qualifier="TRK" root_project_id="2" root_snapshot_id="[null]" parent_snapshot_id="[null]" STATUS="P" ISLAST="true" path="" depth="0"/> <!-- Java package --> - <snapshots var_mode_1="[null]" var_label_1="[null]" var_mode_2="[null]" var_label_2="[null]" var_mode_3="[null]" var_label_3="[null]" id="4" created_at="2008-12-25 01:00:01.00" version="1.0" project_id="3" scope="DIR" qualifier="PAC" + <snapshots variation_mode_1="[null]" variation_param_1="[null]" variation_mode_2="[null]" variation_param_2="[null]" variation_mode_3="[null]" variation_param_3="[null]" variation_mode_4="[null]" variation_param_4="[null]" variation_mode_5="[null]" variation_param_5="[null]" id="4" created_at="2008-12-25 01:00:01.00" version="1.0" project_id="3" scope="DIR" qualifier="PAC" root_project_id="1" root_snapshot_id="2" parent_snapshot_id="2" STATUS="P" ISLAST="true" path="2." depth="1"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/views.xml b/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/views.xml index 9241a6741fe..bf610d8fe92 100644 --- a/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/views.xml +++ b/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/views.xml @@ -20,22 +20,22 @@ <!-- snapshots --> - <snapshots var_mode_1="[null]" var_label_1="[null]" var_mode_2="[null]" var_label_2="[null]" var_mode_3="[null]" var_label_3="[null]" id="1" created_at="2008-12-25 01:00:00.00" version="1.0" project_id="1" scope="PRJ" qualifier="TRK" + <snapshots variation_mode_1="[null]" variation_param_1="[null]" variation_mode_2="[null]" variation_param_2="[null]" variation_mode_3="[null]" variation_param_3="[null]" variation_mode_4="[null]" variation_param_4="[null]" variation_mode_5="[null]" variation_param_5="[null]" id="1" created_at="2008-12-25 01:00:00.00" version="1.0" project_id="1" scope="PRJ" qualifier="TRK" root_project_id="1" root_snapshot_id="[null]" parent_snapshot_id="[null]" STATUS="P" ISLAST="true" path="" depth="0"/> - <snapshots var_mode_1="[null]" var_label_1="[null]" var_mode_2="[null]" var_label_2="[null]" var_mode_3="[null]" var_label_3="[null]" id="2" created_at="2008-12-25 01:00:01.00" version="1.0" project_id="3" scope="PRJ" qualifier="VW" + <snapshots variation_mode_1="[null]" variation_param_1="[null]" variation_mode_2="[null]" variation_param_2="[null]" variation_mode_3="[null]" variation_param_3="[null]" variation_mode_4="[null]" variation_param_4="[null]" variation_mode_5="[null]" variation_param_5="[null]" id="2" created_at="2008-12-25 01:00:01.00" version="1.0" project_id="3" scope="PRJ" qualifier="VW" root_project_id="2" root_snapshot_id="[null]" parent_snapshot_id="[null]" STATUS="P" ISLAST="true" path="" depth="0"/> - <snapshots var_mode_1="[null]" var_label_1="[null]" var_mode_2="[null]" var_label_2="[null]" var_mode_3="[null]" var_label_3="[null]" id="3" created_at="2008-12-25 01:00:01.00" version="1.0" project_id="3" scope="PRJ" qualifier="SVW" + <snapshots variation_mode_1="[null]" variation_param_1="[null]" variation_mode_2="[null]" variation_param_2="[null]" variation_mode_3="[null]" variation_param_3="[null]" variation_mode_4="[null]" variation_param_4="[null]" variation_mode_5="[null]" variation_param_5="[null]" id="3" created_at="2008-12-25 01:00:01.00" version="1.0" project_id="3" scope="PRJ" qualifier="SVW" root_project_id="2" root_snapshot_id="2" parent_snapshot_id="2" STATUS="P" ISLAST="true" path="2." depth="1"/> - <snapshots var_mode_1="[null]" var_label_1="[null]" var_mode_2="[null]" var_label_2="[null]" var_mode_3="[null]" var_label_3="[null]" id="4" created_at="2008-12-25 01:00:00.00" version="1.0" project_id="4" scope="FIL" qualifier="TRK" + <snapshots variation_mode_1="[null]" variation_param_1="[null]" variation_mode_2="[null]" variation_param_2="[null]" variation_mode_3="[null]" variation_param_3="[null]" variation_mode_4="[null]" variation_param_4="[null]" variation_mode_5="[null]" variation_param_5="[null]" id="4" created_at="2008-12-25 01:00:00.00" version="1.0" project_id="4" scope="FIL" qualifier="TRK" root_project_id="2" root_snapshot_id="2" parent_snapshot_id="3" STATUS="P" ISLAST="true" path="2.3." depth="2"/> |