From 5329403a713999ab5ea7b4e9b934a7fd7aeaaefc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Sun, 10 May 2015 23:12:09 +0200 Subject: [PATCH] use first part of email address as username in SFN import --- script/import_scripts/sfn.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/script/import_scripts/sfn.rb b/script/import_scripts/sfn.rb index b5178146c..f8a14f00d 100644 --- a/script/import_scripts/sfn.rb +++ b/script/import_scripts/sfn.rb @@ -40,7 +40,7 @@ class ImportScripts::Sfn < ImportScripts::Base @external_users = {} - CSV.foreach("/Users/zogstrip/Downloads/sfn.csv", col_sep: ";") do |row| + CSV.foreach("/Users/zogstrip/Desktop/sfn.csv", col_sep: ";") do |row| next unless @personify_id_to_contact_key.include?(row[0]) id = @personify_id_to_contact_key[row[0]] @@ -90,6 +90,7 @@ class ImportScripts::Sfn < ImportScripts::Base id: user["id"], email: email, name: full_name, + username: email.split("@")[0], bio_raw: bio, created_at: user["created_at"], post_create_action: proc do |newuser| @@ -191,13 +192,13 @@ class ImportScripts::Sfn < ImportScripts::Base "{9613BAC2-229B-4563-9E1C-35C31CDDCE2F}" => 49, # "Students", } - # def import_categories - # puts "", "importing categories..." + def import_categories + puts "", "importing categories..." - # create_categories(NEW_CATEGORIES) do |category| - # { id: category, name: category } - # end - # end + create_categories(NEW_CATEGORIES) do |category| + { id: category, name: category } + end + end def import_topics puts "", "importing topics..."