MS DG make share_visibility_converter really defensive :(

This commit is contained in:
Maxwell Salzberg 2012-01-18 11:48:23 -08:00
parent 0edb06eef7
commit 0a40cdf288

View file

@ -36,13 +36,17 @@ class ShareVisibilityConverter
puts "Updating batch ##{batch_count} of #{(count/1000)+1}..."
batch_count += 1
visibilities.each do |visibility|
type = visibility.shareable_type
id = visibility.shareable_id.to_s
u = visibility.contact.user
u.hidden_shareables ||= {}
u.hidden_shareables[type] ||= []
u.hidden_shareables[type] << id unless u.hidden_shareables[type].include?(id)
u.save!(:validate => false)
begin
type = visibility.shareable_type
id = visibility.shareable_id.to_s
u = visibility.contact.user
u.hidden_shareables ||= {}
u.hidden_shareables[type] ||= []
u.hidden_shareables[type] << id unless u.hidden_shareables[type].include?(id)
u.save!(:validate => false)
rescue Exception =>e
puts "ERROR: #{e.message} skipping pv with id: #{visibility.id}"
end
end
end
end