1
0
Fork 0

Add method ImportPerson#create_first_contact_date_person_comment

This commit is contained in:
Alex Kotov 2019-07-26 03:30:17 +05:00
parent 1a386949c0
commit f48884da79
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

View file

@ -7,6 +7,7 @@ class ImportPerson
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
create_person create_person
create_general_comments_person_comment create_general_comments_person_comment
create_first_contact_date_person_comment
end end
end end
@ -33,6 +34,18 @@ private
context.general_comments_person_comment.save! context.general_comments_person_comment.save!
end end
def create_first_contact_date_person_comment
return if context.first_contact_date.blank?
context.first_contact_date_person_comment =
context.person.person_comments.where(origin: :first_contact_date)
.lock(true).first_or_initialize
context.first_contact_date_person_comment.text = context.first_contact_date
context.first_contact_date_person_comment.save!
end
def person_attributes def person_attributes
{ {
last_name: context.last_name, last_name: context.last_name,