add

parent c0fe253d
......@@ -6,6 +6,7 @@ class CSVImporter
NAME_DOMAIN = '192.168.1.156'.freeze
FTP_USERNAME = 'training'.freeze
FTP_PASSWORD = 'training'.freeze
def initialize(logger)
@logger = logger
@extracting_directory = Rails.root.join('lib', 'csv')
......@@ -64,18 +65,14 @@ class CSVImporter
industries_relationship = Industry.where(name: industry_name)
industry_job_relationship = IndustryJob.where(job_id: job.id, industry_id: industries_relationship.ids)
if industry_job_relationship.blank?
job.industries << industries_relationship
end
job.industries << industries_relationship if industry_job_relationship.blank?
location_data = row["work place"]
location = location_data.gsub('["', '').gsub('"]', '')
location_relationship = City.where(name: location)
location_job_relationship = CityJob.where(job_id: job.id ,city_id: location_relationship.ids)
if location_job_relationship.blank?
job.cities << location_relationship
end
job.cities << location_relationship if location_job_relationship.blank?
rescue StandardError => e
@logger.error e.message
......
......@@ -15,6 +15,7 @@ class JobParser
links = info.css('div.caption a.company-name').map { |link| link['href'] }
links.each do |link|
next if link == 'javascript:void(0);'
page = Nokogiri::HTML(URI.open(URI.escape(link)))
name = page.search('p.name')&.text
next if name.blank?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment