DEV: Don't import year of birth (#15937)

The cakeday plugin doesn't use the year.
This commit is contained in:
Gerhard Schlager 2022-02-14 18:10:35 +01:00 committed by GitHub
parent f078d1ab0a
commit 33d6ed60a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -431,6 +431,11 @@ class BulkImport::Base
user[:last_emailed_at] ||= NOW
user[:created_at] ||= NOW
user[:updated_at] ||= user[:created_at]
if (date_of_birth = user[:date_of_birth]).is_a?(Date) && date_of_birth.year != 1904
user[:date_of_birth] = Date.new(1904, date_of_birth.month, date_of_birth.day)
end
user
end

View File

@ -332,6 +332,10 @@ class ImportScripts::Base
opts[:import_mode] = true
opts[:last_emailed_at] = opts.fetch(:last_emailed_at, Time.now)
if (date_of_birth = opts[:date_of_birth]).is_a?(Date) && date_of_birth.year != 1904
opts[:date_of_birth] = Date.new(1904, date_of_birth.month, date_of_birth.day)
end
u = User.new(opts)
(opts[:custom_fields] || {}).each { |k, v| u.custom_fields[k] = v }
u.custom_fields["import_id"] = import_id