From: Simon Brandhof Date: Tue, 4 Dec 2012 14:30:18 +0000 (+0100) Subject: Fix migration 360 X-Git-Tag: 3.4~188 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0d61080215bc04dabacf1360c945755d50a8e2b2;p=sonarqube.git Fix migration 360 --- diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_filter_widgets.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_filter_widgets.rb index ec3d14405d0..ab3e3fe3ae8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_filter_widgets.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_filter_widgets.rb @@ -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