Add method ImportPerson#create_first_contact_date_person_comment
This commit is contained in:
parent
1a386949c0
commit
f48884da79
1 changed files with 13 additions and 0 deletions
|
@ -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,
|
||||||
|
|
Reference in a new issue