Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
V
venjob
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 1
    • Issues 1
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 3
    • Merge Requests 3
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Xuan Trung Le
  • venjob
  • Merge Requests
  • !2

Merged
Opened Oct 03, 2017 by Xuan Trung Le@trunglx 
  • Report abuse
Report abuse

implement crawler data from careerbuild

I'm in progress to crawl data use nokogori gem.

  • Discussion 25
  • Commits 12
  • Changes 15
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Xuan Trung Le @trunglx

    added 1 commit

    • 992e35b3 - implement crawler data

    Compare with previous version

    Oct 04, 2017

    added 1 commit

    • 992e35b3 - implement crawler data

    Compare with previous version

    added 1 commit * 992e35b3 - implement crawler data [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3700&start_sha=661293a4c1a34b00c96da0208f60ea58d890719d)
    Toggle commit list
  • Xuan Trung Le @trunglx

    added 1 commit

    • 6514a755 - fix creating a new job

    Compare with previous version

    Oct 05, 2017

    added 1 commit

    • 6514a755 - fix creating a new job

    Compare with previous version

    added 1 commit * 6514a755 - fix creating a new job [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3708&start_sha=992e35b3ac164131858f2f83c0ac86b47425817d)
    Toggle commit list
  • Xuan Trung Le @trunglx

    added 1 commit

    • 5c5c6c7b - Update routes.rb

    Compare with previous version

    Oct 05, 2017

    added 1 commit

    • 5c5c6c7b - Update routes.rb

    Compare with previous version

    added 1 commit * 5c5c6c7b - Update routes.rb [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3709&start_sha=6514a755c2a4410f98cf035839d73d7483dc43c6)
    Toggle commit list
  • Xuan Trung Le @trunglx

    added 1 commit

    • 8d674ad5 - fix data cralwer

    Compare with previous version

    Oct 05, 2017

    added 1 commit

    • 8d674ad5 - fix data cralwer

    Compare with previous version

    added 1 commit * 8d674ad5 - fix data cralwer [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3714&start_sha=5c5c6c7b332362a8e25fafb055eb02517e2299b0)
    Toggle commit list
  • Xuan Trung Le @trunglx

    added 1 commit

    • 65db38d6 - Fix crawling data

    Compare with previous version

    Oct 05, 2017

    added 1 commit

    • 65db38d6 - Fix crawling data

    Compare with previous version

    added 1 commit * 65db38d6 - Fix crawling data [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3728&start_sha=8d674ad5104caed27ed0eef14df1e0992d4105d5)
    Toggle commit list
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 06, 2017
    Resolved by Xuan Trung Le Oct 06, 2017
    app/data/import.rb 0 → 100644
    1 require "crawler.rb"
    • Ba Toi Dang @toidb commented Oct 06, 2017
      Master

      File này dùng để làm gì?

      File này dùng để làm gì?
    • Xuan Trung Le @trunglx

      changed this line in version 7 of the diff

      Oct 06, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc#abea1b4035e984cbbc17947a77fe25bf03f22862_1_0)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 06, 2017
    Resolved by Xuan Trung Le Oct 06, 2017
    app/data/crawler.rb 0 → 100644
    6 class Crawler
    7 BASE_CAREERBUILDER_URL = "https://careerbuilder.vn"
    8 LIST_URL = "#{BASE_CAREERBUILDER_URL}/viec-lam"
    9
    10 def self.crawl_job_infomation(job_links)
    11 links = job_links
    12 job_details = []
    13
    14 links.each do |link|
    15 puts "Fetching #{link}..."
    16 params = {}
    17 link = URI.escape(link)
    18 doc = Nokogiri::HTML(open(link), nil, 'utf-8')
    19
    20 if doc.css('#template_vantai').blank? &&
    21 doc.css('#template_1').blank? &&
    • Ba Toi Dang @toidb commented Oct 06, 2017
      Master

      Có thể ngắn là doc.css('#template_vantai, #template_2, ...').blank?.

      Edited Oct 06, 2017 by Ba Toi Dang
      Có thể ngắn là `doc.css('#template_vantai, #template_2, ...').blank?`.
    • Xuan Trung Le @trunglx

      changed this line in version 7 of the diff

      Oct 06, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc#e5510435ffe1cd1c08f53dc46f3ea496484b075d_21_20)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 06, 2017
    Resolved by Xuan Trung Le Oct 06, 2017
    lib/tasks/data.rake 0 → 100644
    1 ENV["RAILS_ENV"] ||= "production"
    • Ba Toi Dang @toidb commented Oct 06, 2017
      Master

      Tại sao cần set RAILS_ENV là production là mặc định.

      Tại sao cần set `RAILS_ENV` là `production` là mặc định.
    • Xuan Trung Le @trunglx

      changed this line in version 7 of the diff

      Oct 06, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc#3ab5df7d689502d35b7e346d0110155239ec6b1b_1_1)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 06, 2017
    Resolved by Xuan Trung Le Oct 06, 2017
    db/migrate/20171005085453_create_join_table_cities_companies.rb 0 → 100644
    1 class CreateJoinTableCitiesCompanies < ActiveRecord::Migration[5.1]
    2 def change
    3 create_join_table :cities, :companies, id: false do |t|
    4 t.index [:city_id, :company_id]
    • Ba Toi Dang @toidb commented Oct 06, 2017
      Master

      Khai bao kiểu dữ liệu cho trường index. Nếu để như thế này thì sẽ là default bigint dù chỉ cần integer.

      Trùng kiểu index.

      Tài sao lại cần 1 index cho 2 cột.

      P/S. Kiểm tra những nơi khác.

      Khai bao kiểu dữ liệu cho trường index. Nếu để như thế này thì sẽ là default `bigint` dù chỉ cần integer. Trùng kiểu index. Tài sao lại cần 1 index cho 2 cột. P/S. Kiểm tra những nơi khác.
    • Xuan Trung Le @trunglx

      changed this line in version 7 of the diff

      Oct 06, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc#4daa5e2d27244f641b59e615e9c77bd3796dc039_4_3)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 06, 2017
    Resolved by Xuan Trung Le Oct 06, 2017
    app/models/job.rb
    30 job.company.description = item[:company_description]
    31 job.company.cities = job.cities
    32
    33 # Industry
    34 unless item[:industry].blank?
    35 item[:industry].split(',').each do |name|
    36 job.industries << Industry.find_or_create_by(name: name.strip)
    37 end
    38 end
    39 puts "Saving #{item[:name]} ......................................"
    40 job.save
    41 end
    42 end
    43
    44 def self.filter_link_exist(links)
    45 return links - Job.all.map{|job| job.original_link}
    • Ba Toi Dang @toidb commented Oct 06, 2017
      Master

      Không query như thế này Job.all bởi vì khi nhiểu jobs lớn sẽ tốn nhiều memory để lưu trữ data query không cần thiết.

      Có thể kiếm tra các query các link có trong db trước rồi loại ra các link đó sau:

      links - Job.where(original_link: links).pluck(:original_link)
      Không query như thế này `Job.all` bởi vì khi nhiểu jobs lớn sẽ tốn nhiều memory để lưu trữ data query không cần thiết. Có thể kiếm tra các query các link có trong db trước rồi loại ra các link đó sau: ``` links - Job.where(original_link: links).pluck(:original_link) ```
    • Xuan Trung Le @trunglx

      changed this line in version 7 of the diff

      Oct 06, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc#742abd5cbc2b12d2da315862ace6297c7d6dcb87_45_71)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 06, 2017
    Resolved by Xuan Trung Le Oct 06, 2017
    db/migrate/20171004094208_add_original_link_to_jobs.rb 0 → 100644
    1 class AddOriginalLinkToJobs < ActiveRecord::Migration[5.1]
    2 def change
    3 add_column :jobs, :original_link, :string
    • Ba Toi Dang @toidb commented Oct 06, 2017
      Master

      Thêm index cho original_link bởi trường này hay được sử dụng để tìm các link đã tồn tại. Nếu nó là duy nhất thêm index uniq: true.

      Thêm index cho `original_link` bởi trường này hay được sử dụng để tìm các link đã tồn tại. Nếu nó là duy nhất thêm index `uniq: true`.
    • Xuan Trung Le @trunglx

      changed this line in version 7 of the diff

      Oct 06, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc#366182cea87c3c73a85e63b45f66795e5de89367_3_3)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 06, 2017
    Resolved by Xuan Trung Le Oct 06, 2017
    app/models/job.rb
    21 unless item[:city].blank?
    22 item[:city].split(',').each do |name|
    23 job.cities << City.find_or_create_by(name: name.strip)
    24 end
    25 end
    26
    27 # Company
    28 job.company = Company.find_or_create_by(name: item[:company_name])
    29 job.company.location = item[:company_location]
    30 job.company.description = item[:company_description]
    31 job.company.cities = job.cities
    32
    33 # Industry
    34 unless item[:industry].blank?
    35 item[:industry].split(',').each do |name|
    36 job.industries << Industry.find_or_create_by(name: name.strip)
    • Ba Toi Dang @toidb commented Oct 06, 2017
      Master

      Đối với mỗi industry phải tốn 1 câu query để kiểm tra industry. Thay đó có thể thay thế bằng Industry.where(name: item[:industry].split(',')) để tìm các industry có trong db trước. Đối với những cái không có, tạo thêm vào db.

      Đối với mỗi industry phải tốn 1 câu query để kiểm tra industry. Thay đó có thể thay thế bằng `Industry.where(name: item[:industry].split(','))` để tìm các industry có trong db trước. Đối với những cái không có, tạo thêm vào db.
    • Xuan Trung Le @trunglx

      changed this line in version 7 of the diff

      Oct 06, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc#742abd5cbc2b12d2da315862ace6297c7d6dcb87_36_47)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 06, 2017
    Resolved by Xuan Trung Le Oct 06, 2017
    app/models/job.rb
    8 has_and_belongs_to_many :cities
    9
    10 def self.create_new_jobs(arr_jobs)
    11 arr_jobs.each do |item|
    12 job = Job.new(name: item[:name],
    13 salary: item[:salary],
    14 description: item[:description],
    15 level: item[:level],
    16 original_link: item[:original_link],
    17 experience: item[:experience],
    18 expiry_date: item[:expiry_date],
    19 updated_date: item[:updated_date])
    20 # City
    21 unless item[:city].blank?
    22 item[:city].split(',').each do |name|
    23 job.cities << City.find_or_create_by(name: name.strip)
    • Ba Toi Dang @toidb commented Oct 06, 2017
      Master

      Có vấn đề tưởng tự như industry.

      Có vấn đề tưởng tự như `industry`.
    • Xuan Trung Le @trunglx

      changed this line in version 7 of the diff

      Oct 06, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc#742abd5cbc2b12d2da315862ace6297c7d6dcb87_23_26)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 06, 2017
    Resolved by Xuan Trung Le Oct 06, 2017
    app/models/job.rb
    25 end
    26
    27 # Company
    28 job.company = Company.find_or_create_by(name: item[:company_name])
    29 job.company.location = item[:company_location]
    30 job.company.description = item[:company_description]
    31 job.company.cities = job.cities
    32
    33 # Industry
    34 unless item[:industry].blank?
    35 item[:industry].split(',').each do |name|
    36 job.industries << Industry.find_or_create_by(name: name.strip)
    37 end
    38 end
    39 puts "Saving #{item[:name]} ......................................"
    40 job.save
    • Ba Toi Dang @toidb commented Oct 06, 2017
      Master

      Làm sao kiểu tra được job đã được save hay không?

      Làm sao kiểu tra được job đã được save hay không?
    • Xuan Trung Le @trunglx

      changed this line in version 7 of the diff

      Oct 06, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc#742abd5cbc2b12d2da315862ace6297c7d6dcb87_40_60)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 06, 2017
    Resolved by Xuan Trung Le Oct 06, 2017
    app/data/crawler.rb 0 → 100644
    72 description << child.to_html
    73 end
    74 params[:description] = description.join("")
    75
    76 # original_link
    77 params[:original_link] = link
    78
    79 return params
    80 end
    81
    82 def self.crawl_company_infomation(doc)
    83 # get company information
    84 params = {}
    85 if doc.css('.box1Detail .TitleDetailNew span').length > 0
    86 params[:name] = doc.css('.box1Detail .TitleDetailNew span').text
    87 params[:location] = doc.css('.box1Detail .TitleDetailNew label')[0].text
    • Ba Toi Dang @toidb commented Oct 06, 2017
      Master

      Nếu chỉ cần lấy phần tử đầu tiên, có thể dùng at thay cho css.

      Nếu chỉ cần lấy phần tử đầu tiên, có thể dùng `at` thay cho `css`.
    • Xuan Trung Le @trunglx

      changed this line in version 7 of the diff

      Oct 06, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc#e5510435ffe1cd1c08f53dc46f3ea496484b075d_87_83)
      Toggle commit list
    Please register or sign in to reply
  • Xuan Trung Le @trunglx

    added 1 commit

    • f7c44114 - fix crawler data

    Compare with previous version

    Oct 06, 2017

    added 1 commit

    • f7c44114 - fix crawler data

    Compare with previous version

    added 1 commit * f7c44114 - fix crawler data [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3740&start_sha=65db38d69fb3e551a2645b7568895a361e7ce1cc)
    Toggle commit list
  • Xuan Trung Le @trunglx

    resolved all discussions

    Oct 06, 2017

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Xuan Trung Le @trunglx

    added 1 commit

    • a3c73032 - update country setting for city

    Compare with previous version

    Oct 09, 2017

    added 1 commit

    • a3c73032 - update country setting for city

    Compare with previous version

    added 1 commit * a3c73032 - update country setting for city [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3749&start_sha=f7c441144abc186d94c225cb57c1e202c7d83efe)
    Toggle commit list
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 09, 2017
    Resolved by Xuan Trung Le Oct 10, 2017
    app/data/crawler.rb 0 → 100644
    1 # encoding: UTF-8
    2 require 'nokogiri'
    3 require 'uri'
    4 require 'open-uri'
    5
    6 class Crawler
    7 BASE_CAREERBUILDER_URL = "https://careerbuilder.vn"
    8 LIST_URL = "#{BASE_CAREERBUILDER_URL}/viec-lam"
    9
    10 def self.crawl_job_infomation(job_links)
    11 links = job_links
    • Ba Toi Dang @toidb commented Oct 09, 2017
      Master

      Tại sao cần assign job_links vào một biến mới links.

      Tại sao cần assign `job_links` vào một biến mới `links`.
    • Xuan Trung Le @trunglx

      changed this line in version 9 of the diff

      Oct 10, 2017

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3756&start_sha=a3c730328d6cec6449cc6faac7dffc0e18e8e34d#e5510435ffe1cd1c08f53dc46f3ea496484b075d_11_11)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on the diff Oct 09, 2017
    Resolved by Xuan Trung Le Oct 10, 2017
    app/data/crawler.rb 0 → 100644
    2 require 'nokogiri'
    3 require 'uri'
    4 require 'open-uri'
    5
    6 class Crawler
    7 BASE_CAREERBUILDER_URL = "https://careerbuilder.vn"
    8 LIST_URL = "#{BASE_CAREERBUILDER_URL}/viec-lam"
    9
    10 def self.crawl_job_infomation(job_links)
    11 links = job_links
    12 job_details = []
    13
    14 links.each do |link|
    15 puts "Fetching #{link}..."
    16 params = {}
    17 link = URI.escape(link)
    • Ba Toi Dang @toidb commented Oct 09, 2017
      Master

      Tại sao cần escape link.

      Tại sao cần escape link.
    • Xuan Trung Le @trunglx commented Oct 10, 2017
      Master

      You can't read the links that contain Japanese characters by using Nokogiri if you don't this.

      You can't read the links that contain Japanese characters by using Nokogiri if you don't this.
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 09, 2017
    Resolved by Xuan Trung Le Oct 10, 2017
    app/data/crawler.rb 0 → 100644
    14 links.each do |link|
    15 puts "Fetching #{link}..."
    16 params = {}
    17 link = URI.escape(link)
    18 doc = Nokogiri::HTML(open(link), nil, 'utf-8')
    19
    20 if doc.css('#template_vantai, #template_1,
    21 #template_2, #template_3, #template_4,
    22 #template_5, #template_6, #template_7,
    23 #newyear_02').blank?
    24
    25 params = use_template_default(doc, link)
    26 job_details << params
    27 end
    28 end
    29 return job_details
    • Ba Toi Dang @toidb commented Oct 09, 2017
      Master

      Không cần sử dụng return job_details chỉ cần job_details nếu return ở cuối hàm.

      Edited Oct 09, 2017 by Ba Toi Dang
      Không cần sử dụng `return job_details` chỉ cần `job_details` nếu `return` ở cuối hàm.
    • Xuan Trung Le @trunglx

      changed this line in version 9 of the diff

      Oct 10, 2017

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3756&start_sha=a3c730328d6cec6449cc6faac7dffc0e18e8e34d#e5510435ffe1cd1c08f53dc46f3ea496484b075d_29_28)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 09, 2017
    Resolved by Xuan Trung Le Oct 10, 2017
    app/data/crawler.rb 0 → 100644
    14 links.each do |link|
    15 puts "Fetching #{link}..."
    16 params = {}
    17 link = URI.escape(link)
    18 doc = Nokogiri::HTML(open(link), nil, 'utf-8')
    19
    20 if doc.css('#template_vantai, #template_1,
    21 #template_2, #template_3, #template_4,
    22 #template_5, #template_6, #template_7,
    23 #newyear_02').blank?
    24
    25 params = use_template_default(doc, link)
    26 job_details << params
    27 end
    28 end
    29 return job_details
    • Ba Toi Dang @toidb commented Oct 09, 2017
      Master

      Không cần sử dụng return job_details chỉ cần job_details.

      Không cần sử dụng `return job_details` chỉ cần `job_details`.
    • Xuan Trung Le @trunglx

      changed this line in version 9 of the diff

      Oct 10, 2017

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3756&start_sha=a3c730328d6cec6449cc6faac7dffc0e18e8e34d#e5510435ffe1cd1c08f53dc46f3ea496484b075d_29_28)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on the diff Oct 09, 2017
    Resolved by Xuan Trung Le Oct 10, 2017
    app/data/crawler.rb 0 → 100644
    77
    78 def self.crawl_company_infomation(doc)
    79 # get company information
    80 params = {}
    81 if doc.css('.box1Detail .TitleDetailNew span').length > 0
    82 params[:name] = doc.css('.box1Detail .TitleDetailNew span').text
    83 params[:location] = doc.at('.box1Detail .TitleDetailNew label').text
    84 params[:description] = doc.css('.desc_company p').text
    85 end
    86 params[:name] ||= 'Bảo mật'
    87
    88 return params
    89 end
    90
    91 def self.get_job_link
    92 url = "#{LIST_URL}/tat-ca-viec-lam-trang-#{1}-vi.html"
    • Ba Toi Dang @toidb commented Oct 09, 2017
      Master

      Kiểm tra lại chỗ này, tại sao lại dùng #{1}?

      Kiểm tra lại chỗ này, tại sao lại dùng `#{1}`?
    • Xuan Trung Le @trunglx commented Oct 10, 2017
      Master

      this is only temporary.

      this is only temporary.
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 09, 2017
    Resolved by Xuan Trung Le Oct 09, 2017
    app/models/city.rb
    1 1 class City < ApplicationRecord
    2 belongs_to :country
    3 has_many :companies
    4 has_many :jobs
    2 belongs_to :country, optional: true
    3 has_and_belongs_to_many :companies
    4 has_and_belongs_to_many :jobs
    5 def self.list
    6 ['AN GIANG', 'BÀ RỊA - VŨNG TÀU', 'BẮC GIANG', 'BẮC KẠN', 'BẠC LIÊU', 'BẮC NINH', 'BẾN TRE',
    • Ba Toi Dang @toidb commented Oct 09, 2017
      Master

      Lưu các city vào db.

      Lưu các city vào db.
    • Xuan Trung Le @trunglx

      changed this line in version 9 of the diff

      Oct 10, 2017

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3756&start_sha=a3c730328d6cec6449cc6faac7dffc0e18e8e34d#28495972e963898abf2919ffeaeb92fbdf49fb8e_6_5)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 09, 2017
    Resolved by Xuan Trung Le Oct 09, 2017
    app/models/job.rb
    1 1 class Job < ApplicationRecord
    2 belongs_to :city
    3 2 belongs_to :company
    4 3 has_many :apply_jobs
    5 4 has_many :candidates, through: :apply_jobs, class_name: 'User', source: :user
    6 5 has_many :favorite_jobs
    7 6 has_many :people_who_liked, through: :favorite_jobs, class_name: 'User', source: :user
    8 7 has_and_belongs_to_many :industries
    8 has_and_belongs_to_many :cities
    9
    10 def self.create_new_jobs(arr_jobs)
    11 viet_nam = Country.find_or_create_by(name: 'Viet Nam')
    • Ba Toi Dang @toidb commented Oct 09, 2017
      Master

      Move code for creating the country to seed.rb.

      Move code for creating the country to seed.rb.
    • Xuan Trung Le @trunglx

      changed this line in version 9 of the diff

      Oct 10, 2017

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3756&start_sha=a3c730328d6cec6449cc6faac7dffc0e18e8e34d#742abd5cbc2b12d2da315862ace6297c7d6dcb87_11_11)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 09, 2017
    Resolved by Xuan Trung Le Oct 10, 2017
    app/models/job.rb
    13 arr_jobs.each do |item|
    14 job_cities = []
    15 city_name = []
    16 job_industries = []
    17 industry_name = []
    18 job = Job.new(name: item[:name],
    19 salary: item[:salary],
    20 description: item[:description],
    21 level: item[:level],
    22 original_link: item[:original_link],
    23 experience: item[:experience],
    24 expiry_date: item[:expiry_date],
    25 updated_date: item[:updated_date])
    26 # City
    27 unless item[:city].blank?
    28 city_name = item[:city].split(',').map(&:strip)
    • Ba Toi Dang @toidb commented Oct 09, 2017
      Master

      Should use city_names because it is plural.

      Please check others.

      Edited Oct 09, 2017 by Ba Toi Dang
      Should use `city_names` because it is plural. Please check others.
    • Xuan Trung Le @trunglx

      changed this line in version 9 of the diff

      Oct 10, 2017

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3756&start_sha=a3c730328d6cec6449cc6faac7dffc0e18e8e34d#742abd5cbc2b12d2da315862ace6297c7d6dcb87_28_26)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 09, 2017
    Resolved by Xuan Trung Le Oct 10, 2017
    app/data/crawler.rb 0 → 100644
    76 end
    77
    78 def self.crawl_company_infomation(doc)
    79 # get company information
    80 params = {}
    81 if doc.css('.box1Detail .TitleDetailNew span').length > 0
    82 params[:name] = doc.css('.box1Detail .TitleDetailNew span').text
    83 params[:location] = doc.at('.box1Detail .TitleDetailNew label').text
    84 params[:description] = doc.css('.desc_company p').text
    85 end
    86 params[:name] ||= 'Bảo mật'
    87
    88 return params
    89 end
    90
    91 def self.get_job_link
    • Ba Toi Dang @toidb commented Oct 09, 2017
      Master

      It should be get_job_link because it is plural.

      It should be `get_job_link` because it is plural.
    • Xuan Trung Le @trunglx

      changed this line in version 9 of the diff

      Oct 10, 2017

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3756&start_sha=a3c730328d6cec6449cc6faac7dffc0e18e8e34d#e5510435ffe1cd1c08f53dc46f3ea496484b075d_91_91)
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 09, 2017
    Resolved by Xuan Trung Le Oct 09, 2017
    app/data/crawler.rb 0 → 100644
    76 end
    77
    78 def self.crawl_company_infomation(doc)
    79 # get company information
    80 params = {}
    81 if doc.css('.box1Detail .TitleDetailNew span').length > 0
    82 params[:name] = doc.css('.box1Detail .TitleDetailNew span').text
    83 params[:location] = doc.at('.box1Detail .TitleDetailNew label').text
    84 params[:description] = doc.css('.desc_company p').text
    85 end
    86 params[:name] ||= 'Bảo mật'
    87
    88 return params
    89 end
    90
    91 def self.get_job_link
    • Ba Toi Dang @toidb commented Oct 09, 2017
      Master

      It should be get_job_link because it is plural.

      It should be `get_job_link` because it is plural.
    • Xuan Trung Le @trunglx

      changed this line in version 9 of the diff

      Oct 10, 2017

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3756&start_sha=a3c730328d6cec6449cc6faac7dffc0e18e8e34d#e5510435ffe1cd1c08f53dc46f3ea496484b075d_91_91)
      Toggle commit list
    Please register or sign in to reply
  • Xuan Trung Le @trunglx

    resolved all discussions

    Oct 10, 2017

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Xuan Trung Le @trunglx

    added 1 commit

    • eeeefc0a - fix bugs

    Compare with previous version

    Oct 10, 2017

    added 1 commit

    • eeeefc0a - fix bugs

    Compare with previous version

    added 1 commit * eeeefc0a - fix bugs [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3756&start_sha=a3c730328d6cec6449cc6faac7dffc0e18e8e34d)
    Toggle commit list
  • Xuan Trung Le @trunglx

    resolved all discussions

    Oct 10, 2017

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 11, 2017
    Resolved by Xuan Trung Le Oct 13, 2017
    app/models/job.rb
    20 original_link: item[:original_link],
    21 experience: item[:experience],
    22 expiry_date: item[:expiry_date],
    23 updated_date: item[:updated_date])
    24 # City
    25 unless item[:city].blank?
    26 city_names = item[:city].split(',').map(&:strip)
    27
    28 job_cities = City.where(name: city_names)
    29 job_cities.each do |city|
    30 job.cities << city
    31 end
    32 end
    33
    34 # Company
    35 job.company = Company.find_or_create_by(name: item[:company_name])
    • Ba Toi Dang @toidb commented Oct 11, 2017
      Master

      Please optimize code here.

      Please optimize code here.
    • Xuan Trung Le @trunglx

      changed this line in version 10 of the diff

      Oct 13, 2017

      changed this line in version 10 of the diff

      changed this line in [version 10 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3764&start_sha=eeeefc0afbae50e21708d8db9a167920373abf4d#742abd5cbc2b12d2da315862ace6297c7d6dcb87_35_30)
      Toggle commit list
    • Xuan Trung Le @trunglx

      created #1 to continue this discussion

      Oct 13, 2017

      created #1 to continue this discussion

      created #1 to continue this discussion
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 11, 2017
    Resolved by Xuan Trung Le Oct 13, 2017
    app/models/job.rb
    20 original_link: item[:original_link],
    21 experience: item[:experience],
    22 expiry_date: item[:expiry_date],
    23 updated_date: item[:updated_date])
    24 # City
    25 unless item[:city].blank?
    26 city_names = item[:city].split(',').map(&:strip)
    27
    28 job_cities = City.where(name: city_names)
    29 job_cities.each do |city|
    30 job.cities << city
    31 end
    32 end
    33
    34 # Company
    35 job.company = Company.find_or_create_by(name: item[:company_name])
    • Ba Toi Dang @toidb commented Oct 11, 2017
      Master

      Please optimize code here.

      Please optimize code here.
    • Xuan Trung Le @trunglx

      changed this line in version 10 of the diff

      Oct 13, 2017

      changed this line in version 10 of the diff

      changed this line in [version 10 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3764&start_sha=eeeefc0afbae50e21708d8db9a167920373abf4d#742abd5cbc2b12d2da315862ace6297c7d6dcb87_35_30)
      Toggle commit list
    • Xuan Trung Le @trunglx

      created #1 to continue this discussion

      Oct 13, 2017

      created #1 to continue this discussion

      created #1 to continue this discussion
      Toggle commit list
    Please register or sign in to reply
  • Ba Toi Dang
    @toidb started a discussion on an old version of the diff Oct 11, 2017
    Resolved by Xuan Trung Le Oct 13, 2017
    app/models/job.rb
    14 job_industries = []
    15 industry_names = []
    16 job = Job.new(name: item[:name],
    17 salary: item[:salary],
    18 description: item[:description],
    19 level: item[:level],
    20 original_link: item[:original_link],
    21 experience: item[:experience],
    22 expiry_date: item[:expiry_date],
    23 updated_date: item[:updated_date])
    24 # City
    25 unless item[:city].blank?
    26 city_names = item[:city].split(',').map(&:strip)
    27
    28 job_cities = City.where(name: city_names)
    29 job_cities.each do |city|
    • Ba Toi Dang @toidb commented Oct 11, 2017
      Master

      job.cities = City.where(name: city_names)

      `job.cities` = `City.where(name: city_names)`
    • Xuan Trung Le @trunglx

      changed this line in version 10 of the diff

      Oct 13, 2017

      changed this line in version 10 of the diff

      changed this line in [version 10 of the diff](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3764&start_sha=eeeefc0afbae50e21708d8db9a167920373abf4d#742abd5cbc2b12d2da315862ace6297c7d6dcb87_29_26)
      Toggle commit list
    • Xuan Trung Le @trunglx

      created #1 to continue this discussion

      Oct 13, 2017

      created #1 to continue this discussion

      created #1 to continue this discussion
      Toggle commit list
    Please register or sign in to reply
  • Xuan Trung Le @trunglx

    added 1 commit

    • de86016d - optimize code

    Compare with previous version

    Oct 13, 2017

    added 1 commit

    • de86016d - optimize code

    Compare with previous version

    added 1 commit * de86016d - optimize code [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3764&start_sha=eeeefc0afbae50e21708d8db9a167920373abf4d)
    Toggle commit list
  • Xuan Trung Le @trunglx

    added 1 commit

    • 3e82e42a - optimize code

    Compare with previous version

    Oct 13, 2017

    added 1 commit

    • 3e82e42a - optimize code

    Compare with previous version

    added 1 commit * 3e82e42a - optimize code [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3765&start_sha=de86016d499cbac10b88d2736a16b26005907459)
    Toggle commit list
  • Xuan Trung Le @trunglx

    mentioned in issue #1

    Oct 13, 2017

    mentioned in issue #1

    mentioned in issue #1
    Toggle commit list
  • Xuan Trung Le @trunglx

    resolved all discussions

    Oct 13, 2017

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Xuan Trung Le @trunglx

    added 1 commit

    • 5c50f4b3 - optimize code

    Compare with previous version

    Oct 13, 2017

    added 1 commit

    • 5c50f4b3 - optimize code

    Compare with previous version

    added 1 commit * 5c50f4b3 - optimize code [Compare with previous version](https://gitlab.zigexn.vn/trunglx/venjob/merge_requests/2/diffs?diff_id=3766&start_sha=3e82e42a0138a0aa83add68bfecb83ebf9dd6ce9)
    Toggle commit list
  • Ba Toi Dang @toidb

    mentioned in commit 91b545e3

    Oct 13, 2017

    mentioned in commit 91b545e3

    mentioned in commit 91b545e3685a56b535c9905838040868191d9dc5
    Toggle commit list
  • Ba Toi Dang @toidb

    merged

    Oct 13, 2017

    merged

    merged
    Toggle commit list
  • Write
  • Preview
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 sign in to comment
Xuan Trung Le
Assignee
Xuan Trung Le @trunglx
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
2 participants
Reference: trunglx/venjob!2
×

Revert this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.