mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 04:37:30 +02:00
move constants to methods
This commit is contained in:
parent
f7a5e21db0
commit
6b6a41ae20
2 changed files with 15 additions and 6 deletions
|
@ -1,10 +1,8 @@
|
|||
HEADERS = %w[domain id name code registrar].freeze
|
||||
|
||||
namespace :contacts do
|
||||
desc 'Starts collect invalid validation contacts'
|
||||
task scan_org: :environment do
|
||||
csv = CSV.open('invalid_business_contacts.csv', 'w')
|
||||
csv << HEADERS
|
||||
csv << set_headers
|
||||
|
||||
Contact.where(ident_type: 'org').find_in_batches do |contact_group|
|
||||
contact_group.each do |contact|
|
||||
|
@ -17,9 +15,16 @@ namespace :contacts do
|
|||
end
|
||||
end
|
||||
end
|
||||
csv.close
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_headers
|
||||
%w[domain id name code registrar]
|
||||
end
|
||||
|
||||
def checking_contacts(contact)
|
||||
return true unless contact.ident_country_code == 'EE'
|
||||
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
FILE_NAME = './ettevotja_rekvisiidid_init.csv'.freeze
|
||||
|
||||
namespace :collect_csv_data do
|
||||
desc 'Import from csv registry business contact into BusinessRegistryContact model'
|
||||
|
||||
task business_contacts: :environment do
|
||||
ScanCsvRegistryBusinnesContactsJob.perform_later(FILE_NAME)
|
||||
ScanCsvRegistryBusinnesContactsJob.perform_later(filename)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def filename
|
||||
'./ettevotja_rekvisiidid_init.csv'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue