add some output to category and topic importer

This commit is contained in:
Neil Lalonde 2018-01-24 12:13:14 -05:00
parent 3ad48e0d30
commit 594efa37b6
1 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,8 @@ module ImportExport
def import_users def import_users
return if @users.blank? return if @users.blank?
puts "Importing users..."
@users.each do |u| @users.each do |u|
import_id = "#{u[:id]}#{import_source}" import_id = "#{u[:id]}#{import_source}"
existing = User.with_email(u[:email]).first existing = User.with_email(u[:email]).first
@ -52,6 +54,8 @@ module ImportExport
def import_groups def import_groups
return if @groups.blank? return if @groups.blank?
puts "Importing groups..."
@groups.each do |group_data| @groups.each do |group_data|
g = group_data.dup g = group_data.dup
user_ids = g.delete(:user_ids) user_ids = g.delete(:user_ids)
@ -68,6 +72,8 @@ module ImportExport
def import_categories def import_categories
return if @categories.blank? return if @categories.blank?
puts "Importing categories..."
import_ids = @categories.collect { |c| "#{c[:id]}#{import_source}" } import_ids = @categories.collect { |c| "#{c[:id]}#{import_source}" }
existing_categories = CategoryCustomField.where("name = 'import_id' AND value IN (?)", import_ids).select(:category_id, :value).to_a existing_categories = CategoryCustomField.where("name = 'import_id' AND value IN (?)", import_ids).select(:category_id, :value).to_a
existing_category_ids = existing_categories.pluck(:value) existing_category_ids = existing_categories.pluck(:value)
@ -106,6 +112,8 @@ module ImportExport
def import_topics def import_topics
return if @topics.blank? return if @topics.blank?
puts "Importing topics...", ''
@topics.each do |t| @topics.each do |t|
puts "" puts ""
print t[:title] print t[:title]