]> source.dussan.org Git - sonarqube.git/commitdiff
Fix migration 360
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 4 Dec 2012 14:30:18 +0000 (15:30 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 4 Dec 2012 14:33:59 +0000 (15:33 +0100)
sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_filter_widgets.rb

index ec3d14405d0fa0336548b82bd7533f05c345e59c..ab3e3fe3ae85a9321ea4cbdd74159449dba145fe 100644 (file)
@@ -38,20 +38,20 @@ class MoveFilterWidgets < ActiveRecord::Migration
   def self.up
     widgets = Widget.find(:all, :conditions => ["widget_key='filter'"])
     say_with_time "Updading #{widgets.size} widgets" do
-    widgets.each do |widget|
-      dashboard = Dashboard.find_by_id(widget.dashboard_id)
-      widget_property = WidgetProperty.find(:first, :conditions => {:widget_id => widget.id, :kee => 'filter'})
-      if dashboard && widget_property
-        filter = MeasureFilter.find(:first,:conditions => ['name=? and user_id=?', widget_property.text_value, dashboard.user_id]) if dashboard.user_id
-        filter = MeasureFilter.find(:first,:conditions => ['name=? and shared=?', widget_property.text_value, true]) unless filter
-        if filter
-          widget_property.text_value = filter.id.to_s
-          widget_property.save
-          widget.widget_key = (filter.data.include?('display=treemap') ? 'measure_filter_treemap' : 'measure_filter_list')
-          widget.save
+      widgets.each do |widget|
+        dashboard = Dashboard.find_by_id(widget.dashboard_id)
+        widget_property = WidgetProperty.find(:first, :conditions => {:widget_id => widget.id, :kee => 'filter'})
+        if dashboard && widget_property
+          filter = MeasureFilter.find(:first, :conditions => ['name=? and user_id=?', widget_property.text_value, dashboard.user_id]) if dashboard.user_id
+          filter = MeasureFilter.find(:first, :conditions => ['name=? and shared=?', widget_property.text_value, true]) unless filter
+          if filter
+            widget_property.text_value = filter.id.to_s
+            widget_property.save
+            widget.widget_key = (filter.data.include?('display=treemap') ? 'measure_filter_treemap' : 'measure_filter_list')
+            widget.save
+          end
         end
       end
     end
   end
-
 end