FIX: vBulletin bulk importer

This commit is contained in:
Régis Hanol 2017-07-24 14:22:00 +02:00
parent d9696c98c3
commit 57d6a5dc9c
2 changed files with 4 additions and 3 deletions

View File

@ -93,7 +93,7 @@ class BulkImport::Base
puts "Loading users indexes..."
@last_user_id = User.unscoped.maximum(:id)
@emails = User.unscoped.pluck(:"user_emails.email").to_set
@emails = User.unscoped.joins(:user_emails).pluck(:"user_emails.email").to_set
@usernames_lower = User.unscoped.pluck(:username_lower).to_set
@mapped_usernames = UserCustomField.joins(:user).where(name: "import_username").pluck("user_custom_fields.value", "users.username").to_h
@ -138,7 +138,7 @@ class BulkImport::Base
}
USER_COLUMNS ||= %i{
id username username_lower name email active trust_level admin moderator
id username username_lower name active trust_level admin moderator
date_of_birth ip_address registration_ip_address primary_group_id
suspended_at suspended_till last_emailed_at created_at updated_at
}

View File

@ -360,7 +360,8 @@ class BulkImport::VBulletin < BulkImport::Base
def parse_birthday(birthday)
return if birthday.blank?
date_of_birth = Date.strptime(birthday, "%m-%d-%Y")
date_of_birth = Date.strptime(birthday.gsub(/[^\d-]+/, ""), "%m-%d-%Y") rescue nil
return if date_of_birth.nil?
date_of_birth.year < 1904 ? Date.new(1904, date_of_birth.month, date_of_birth.day) : date_of_birth
end