Story#108521790 - add tech contacts relation to domain history

This commit is contained in:
Vladimir Krylov 2015-12-10 13:53:55 +02:00
parent 8dfb62151d
commit 112dac9e7c
4 changed files with 13 additions and 2 deletions

View file

@ -9,6 +9,7 @@ module Legacy
belongs_to :history, foreign_key: :historyid
has_one :object_history, foreign_key: :historyid, primary_key: :historyid
has_many :domain_contact_map_histories, foreign_key: :historyid, primary_key: :historyid
has_many :nsset_contact_map_histories, foreign_key: :historyid, primary_key: :historyid
def get_current_domain_object(time, change_param)
x = self
@ -39,6 +40,10 @@ module Legacy
c_ids = domain_contact_map_histories.pluck(:contactid).join("','")
DomainVersion.where("object->>'legacy_id' IN ('#{c_ids}')").uniq.pluck(:item_id)
end
def get_tech_contact_new_ids
c_ids = nsset_contact_map_histories.pluck(:contactid).join("','")
DomainVersion.where("object->>'legacy_id' IN ('#{c_ids}')").uniq.pluck(:item_id)
end
def new_registrant_id
@new_registrant_id ||= ::Contact.find_by(legacy_id: registrant).try(:id)