Commit 591cf6e6 by thanhnd

fix review 20200218

parent 241d47d2
Pipeline #465 canceled with stages
in 0 seconds
...@@ -5,6 +5,5 @@ class CreateAreas < ActiveRecord::Migration[6.0] ...@@ -5,6 +5,5 @@ class CreateAreas < ActiveRecord::Migration[6.0]
t.string :area_description t.string :area_description
t.timestamps t.timestamps
end end
add_index :areas, :id, unique: true
end end
end end
...@@ -6,6 +6,6 @@ class CreateCities < ActiveRecord::Migration[6.0] ...@@ -6,6 +6,6 @@ class CreateCities < ActiveRecord::Migration[6.0]
t.column :city_description, :string t.column :city_description, :string
t.timestamps t.timestamps
end end
add_index :cities, [:area_id, :id], unique: true add_index :cities, :area_id
end end
end end
...@@ -10,6 +10,6 @@ class CreateCompanies < ActiveRecord::Migration[6.0] ...@@ -10,6 +10,6 @@ class CreateCompanies < ActiveRecord::Migration[6.0]
t.column :size, :int t.column :size, :int
t.timestamps t.timestamps
end end
add_index :companies, [:id, :email], unique: true add_index :companies, :email
end end
end end
...@@ -5,6 +5,5 @@ class CreateIndustries < ActiveRecord::Migration[6.0] ...@@ -5,6 +5,5 @@ class CreateIndustries < ActiveRecord::Migration[6.0]
t.column :industry_description, :string t.column :industry_description, :string
t.timestamps t.timestamps
end end
add_index :industries, :id, unique: true
end end
end end
...@@ -5,6 +5,5 @@ class CreateIndustryJobs < ActiveRecord::Migration[6.0] ...@@ -5,6 +5,5 @@ class CreateIndustryJobs < ActiveRecord::Migration[6.0]
t.column :job_id, :int, :null => false t.column :job_id, :int, :null => false
t.timestamps t.timestamps
end end
add_index :industry_jobs, :id, unique: true
end end
end end
...@@ -5,6 +5,5 @@ class CreateSavedJobs < ActiveRecord::Migration[6.0] ...@@ -5,6 +5,5 @@ class CreateSavedJobs < ActiveRecord::Migration[6.0]
t.column :job_id, :int, :null => false t.column :job_id, :int, :null => false
t.timestamps t.timestamps
end end
add_index :saved_jobs, :id, unique: true
end end
end end
...@@ -5,6 +5,5 @@ class CreateAppliedJobs < ActiveRecord::Migration[6.0] ...@@ -5,6 +5,5 @@ class CreateAppliedJobs < ActiveRecord::Migration[6.0]
t.column :job_id, :int, :null => false t.column :job_id, :int, :null => false
t.timestamps t.timestamps
end end
add_index :applied_jobs, :id, unique: true
end end
end end
...@@ -17,7 +17,6 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do ...@@ -17,7 +17,6 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do
t.integer "job_id", null: false t.integer "job_id", null: false
t.datetime "created_at", precision: 6, null: false t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
t.index ["id"], name: "index_applied_jobs_on_id", unique: true
end end
create_table "areas", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "areas", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
...@@ -25,7 +24,6 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do ...@@ -25,7 +24,6 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do
t.string "area_description" t.string "area_description"
t.datetime "created_at", precision: 6, null: false t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
t.index ["id"], name: "index_areas_on_id", unique: true
end end
create_table "cities", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "cities", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
...@@ -34,7 +32,7 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do ...@@ -34,7 +32,7 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do
t.string "city_description" t.string "city_description"
t.datetime "created_at", precision: 6, null: false t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
t.index ["area_id", "id"], name: "index_cities_on_area_id_and_id", unique: true t.index ["area_id"], name: "index_cities_on_area_id"
end end
create_table "companies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "companies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
...@@ -47,7 +45,7 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do ...@@ -47,7 +45,7 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do
t.integer "size" t.integer "size"
t.datetime "created_at", precision: 6, null: false t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
t.index ["id", "email"], name: "index_companies_on_id_and_email", unique: true t.index ["email"], name: "index_companies_on_email"
end end
create_table "industries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "industries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
...@@ -55,7 +53,6 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do ...@@ -55,7 +53,6 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do
t.string "industry_description" t.string "industry_description"
t.datetime "created_at", precision: 6, null: false t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
t.index ["id"], name: "index_industries_on_id", unique: true
end end
create_table "industry_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "industry_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
...@@ -63,7 +60,6 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do ...@@ -63,7 +60,6 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do
t.integer "job_id", null: false t.integer "job_id", null: false
t.datetime "created_at", precision: 6, null: false t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
t.index ["id"], name: "index_industry_jobs_on_id", unique: true
end end
create_table "jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
...@@ -87,7 +83,6 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do ...@@ -87,7 +83,6 @@ ActiveRecord::Schema.define(version: 2020_02_11_083438) do
t.integer "job_id", null: false t.integer "job_id", null: false
t.datetime "created_at", precision: 6, null: false t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
t.index ["id"], name: "index_saved_jobs_on_id", unique: true
end end
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
......
...@@ -29,18 +29,19 @@ namespace :crawler do ...@@ -29,18 +29,19 @@ namespace :crawler do
uri = URI::encode(url) uri = URI::encode(url)
job = Nokogiri::HTML(open(uri)) job = Nokogiri::HTML(open(uri))
detail_selector = '#showScroll .DetailJobNew'
title = job.css('.top-job-info h1') title = job.css('.top-job-info h1')
company_name = job.css('.top-job-info div.tit_company') company_name = job.css('.top-job-info .tit_company')
updated_date = job.css('.datepost span') updated_date = job.css('.datepost span')
location = job.css('#showScroll .DetailJobNew li[1].bgLine1 p[1].fl_left b a[2]') location = job.css("#{detail_selector} li[1].bgLine1 p[1].fl_left b a[2]")
experience = job.css('#showScroll .DetailJobNew li[2].bgLine2 p[1].fl_left > text()') experience = job.css("#{detail_selector} li[2].bgLine2 p[1].fl_left > text()")
industry = job.css('#showScroll .DetailJobNew li[3].bgLine1 p[1].fl_left b') industry = job.css("#{detail_selector} li[3].bgLine1 p[1].fl_left b")
level = job.css('#showScroll .DetailJobNew .bgLine1 .fl_right label') level = job.css("#{detail_selector} .bgLine1 .fl_right label")
salary = job.css('#showScroll .DetailJobNew .bgLine2 .fl_right label') salary = job.css("#{detail_selector} .bgLine2 .fl_right label")
deadline = job.css('#showScroll .DetailJobNew li[3].bgLine1 p[2].fl_right > text()') deadline = job.css("#{detail_selector} li[3].bgLine1 p[2].fl_right > text()")
description = job.css('.MarBot20') description = job.css('.MarBot20')
address = job.css('.box1Detail .TitleDetailNew label label') address = job.css('.box1Detail .TitleDetailNew label label')
company_intro = job.css('.desc_company.content_fck span#emp_more') company_intro = job.css('#emp_more')
#skip if field blank #skip if field blank
next if industry.text.blank? next if industry.text.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