change registrant query

This commit is contained in:
oleghasjanov 2025-01-10 13:29:08 +02:00
parent 8a93a8b4d2
commit 92f82194e1

View file

@ -45,12 +45,14 @@ class CompanyRegisterStatusJob < ApplicationJob
end
def sampling_registrant_contact(days_interval)
Registrant.where(ident_type: 'org', ident_country_code: 'EE').where(
"(company_register_status IS NULL OR checked_company_at IS NULL) OR
(company_register_status = ? AND checked_company_at < ?) OR
company_register_status IN (?)",
Contact::REGISTERED, days_interval.days.ago, [Contact::LIQUIDATED, Contact::BANKRUPT, Contact::DELETED]
)
Contact.joins(:registrant_domains)
.where(ident_type: 'org', ident_country_code: 'EE')
.where(
"(company_register_status IS NULL OR checked_company_at IS NULL) OR
(company_register_status = ? AND checked_company_at < ?) OR
company_register_status IN (?)",
Contact::REGISTERED, 365.days.ago, [Contact::LIQUIDATED, Contact::BANKRUPT, Contact::DELETED]
).distinct
end
def update_validation_company_status(contact:, status:)