]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5320 When hours in day property has been overload, some migrations are failing
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 19 May 2014 16:43:13 +0000 (18:43 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 19 May 2014 16:43:13 +0000 (18:43 +0200)
sonar-server/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb
sonar-server/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb
sonar-server/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb

index 95b215477bff9f94324b7aa36c45ac5967e16d43..52e1e0a1dca53c73e6e5a5e8a10dc79a19b2e399 100644 (file)
@@ -30,7 +30,7 @@ class UpdateWorkUnitsBySizePointPropertyToMinutes < ActiveRecord::Migration
 
   def self.up
     hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay')
-    hours_in_day = hours_in_day_prop ? hours_in_day_prop : 8
+    hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8
     work_units_by_size_point = Property.find_by_prop_key('workUnitsBySizePoint')
     if work_units_by_size_point && work_units_by_size_point.text_value && work_units_by_size_point.text_value.to_f
       work_units_by_size_point.text_value = convert_days_to_minutes(work_units_by_size_point.text_value.to_f, hours_in_day)
index 8f377efe07be05a28429f27a2832451ee4e4b181..ab98a590d40b7849cfa0be1e510aa89cdc28b9b6 100644 (file)
@@ -34,7 +34,7 @@ class UpdateConditionsOnDebtToMinutes < ActiveRecord::Migration
 
   def self.up
     hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay')
-    hours_in_day = hours_in_day_prop ? hours_in_day_prop : 8
+    hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8
 
     metrics = Metric.find(:all, :conditions => ['name in (?)', ['sqale_index', 'new_technical_debt',
                                                                 'sqale_effort_to_grade_a', 'sqale_effort_to_grade_b', 'sqale_effort_to_grade_c', 'sqale_effort_to_grade_d',
index 6c4c80de504c649607d72e145c7409b4e6904139..ed1509cb1c7f3e4e61ca8e0aaeabbe8fc8ee21f7 100644 (file)
@@ -34,7 +34,7 @@ class UpdateMeasureFiltersOnDebtToMinutes < ActiveRecord::Migration
 
   def self.up
     hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay')
-    hours_in_day = hours_in_day_prop ? hours_in_day_prop : 8
+    hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8
 
     filters = MeasureFilter.all(:conditions => "data LIKE '%_metric=sqale_index%' OR data LIKE '%_metric=new_technical_debt%'" +
         " OR data LIKE '%_metric=sqale_effort_to_grade_a%' OR data LIKE '%_metric=sqale_effort_to_grade_b%' OR data LIKE '%_metric=sqale_effort_to_grade_c%' " +