diff options
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb index eb0cdbaa50d..a7ddebd1602 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb @@ -78,14 +78,15 @@ class CreateGlobalDashboardsForFilter < ActiveRecord::Migration def self.activate_dashboards(dashboard_per_filter) ActiveFilter.find(:all).each do |activeFilter| - filter = Filter.find(activeFilter.filter_id) - - dashboard = dashboard_per_filter[filter.id] - - if !filter.favourites || activeFilter.user_id - ActiveDashboard.create(:dashboard_id => dashboard.id, - :user_id => activeFilter.user_id, - :order_index => activeFilter.order_index) + filter = Filter.find_by_id(activeFilter.filter_id) + if filter + dashboard = dashboard_per_filter[filter.id] + + if !filter.favourites || activeFilter.user_id + ActiveDashboard.create(:dashboard_id => dashboard.id, + :user_id => activeFilter.user_id, + :order_index => activeFilter.order_index) + end end end end |