change logic job_parser

parent 529cabcb
......@@ -35,18 +35,16 @@ class JobParser
location_relationship = row.css('div.map p a').children.map { |name_city| name_city.text.strip }
cities_relationship = City.where(name: location_relationship)
city_job_relationship = CityJob.where(job_id: job.id ,city_id: cities_relationship.ids)
if city_job_relationship.blank?
job.cities << cities_relationship
end
job.cities << cities_relationship if city_job_relationship.blank?
end
def industry_relationship(row, job)
industry_relationship = row.css('li a').children.map { |name_industry| name_industry.text.strip }
industries_relationship = Industry.where(name: industry_relationship)
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?
end
def create_job(title, link_page, row, company)
......
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