FIX: group import/export bugs in category exporter

This commit is contained in:
Neil Lalonde 2016-02-02 16:06:19 -05:00
parent d41cbc5a30
commit 0d611ed8cb
2 changed files with 3 additions and 3 deletions

View File

@ -35,11 +35,11 @@ module ImportExport
# export groups that are mentioned in category permissions
group_names = []
auto_group_names = Group::AUTO_GROUPS.keys
auto_group_names = Group::AUTO_GROUPS.keys.map(&:to_s)
([@export_data[:category]] + @export_data[:subcategories]).each do |c|
c[:permissions_params].each do |group_name, _|
group_names << group_name unless auto_group_names.include?(group_name)
group_names << group_name unless auto_group_names.include?(group_name.to_s)
end
end

View File

@ -28,7 +28,7 @@ module ImportExport
external_id = g.delete(:id)
new_group = Group.find_by_name(g[:name]) || Group.create!(g)
user_ids.each do |external_user_id|
new_group.add( User.find(@topic_importer.new_user_id(external_user_id)) )
new_group.add( User.find(@topic_importer.new_user_id(external_user_id)) ) rescue ActiveRecord::RecordNotUnique
end
end
end