Merge branch '105842700-registrants_portal' into staging

This commit is contained in:
Stas 2016-02-01 15:56:12 +02:00
commit af5b67a07a
3 changed files with 21 additions and 9 deletions

View file

@ -22,11 +22,16 @@ class BusinessRegistryCache < ActiveRecord::Base
# 1. load domains by business
# 2. load domains by person
def associated_contacts
contact_ids = Contact.where(ident_type: 'org', ident: associated_businesses, ident_country_code: 'EE').pluck(:id)
contact_ids += Contact.where(ident_type: 'priv', ident: ident, ident_country_code: ident_country_code).pluck(:id)
contact_ids
end
def associated_domains
domains = []
contact_ids = Contact.where(ident_type: 'org', ident: associated_businesses, ident_country_code: 'EE').pluck(:id)
contact_ids += Contact.where(ident_type: 'priv', ident: ident, ident_country_code: ident_country_code).pluck(:id)
contact_ids = associated_contacts
unless contact_ids.blank?
domains = DomainContact.distinct.where(contact_id: contact_ids).pluck(:domain_id)