fix crawler

parent 2a939b3b
Pipeline #1360 failed with stages
in 0 seconds
...@@ -12,7 +12,7 @@ namespace :crawler do ...@@ -12,7 +12,7 @@ namespace :crawler do
job_listing = parse_job_page.css('div.job-item') job_listing = parse_job_page.css('div.job-item')
per_page = job_listing.present? ? job_listing.length : 0 per_page = job_listing.present? ? job_listing.length : 0
page = 1 page = 1
total = parse_job_page.css('div.job-found p').text.split(' ')[0].gsub(',', '').to_i total = parse_job_page.css('div.job-found p').text.gsub(/[^0-9]/, '')
last_page = (total.to_f / per_page).round last_page = (total.to_f / per_page).round
while page <= last_page while page <= last_page
...@@ -105,7 +105,7 @@ namespace :crawler do ...@@ -105,7 +105,7 @@ namespace :crawler do
name = industry.text.squish name = industry.text.squish
job_industries << Industry.find_by(name: name) job_industries << Industry.find_by(name: name)
end end
next if job_industries_cities.nil? next if job_industries.nil?
job.industries << job_industries job.industries << job_industries
......
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