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 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Đường Sỹ Hoàng
  • VenJob
  • Merge Requests
  • !3

Merged
Opened Dec 10, 2019 by Đường Sỹ Hoàng@hoangds 
  • Report abuse
Report abuse

Feature/import jobs

×

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b feature/import_jobs origin/feature/import_jobs

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git checkout master
git merge --no-ff feature/import_jobs

Step 4. Push the result of the merge to GitLab

git push origin master

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

  • Discussion 8
  • Commits 10
  • Changes 14
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Son Do Hong
    @sondh started a discussion on an old version of the diff Dec 10, 2019
    Last updated by Đường Sỹ Hoàng Dec 10, 2019
    db/migrate/20191210034127_change_integer_limit_job.rb 0 → 100644
    1 class ChangeIntegerLimitJob < ActiveRecord::Migration[6.0]
    2 def change
    3 change_column :jobs, :company_id, :integer, limit: 8
    • Son Do Hong @sondh commented Dec 10, 2019
      Master

      giữ nguyên trường company_id như cũ

      giữ nguyên trường `company_id` như cũ
    • Đường Sỹ Hoàng @hoangds

      changed this line in version 2 of the diff

      Dec 10, 2019

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4449&start_sha=fcc712c52ec04125aaa28512008d30aba22dd8b5#68f917de5d7cdb99aa393f7ffb6cfab1086cf20a_3_0)
      Toggle commit list
    Please register or sign in to reply
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Dec 10, 2019
    Last updated by Đường Sỹ Hoàng Dec 10, 2019
    lib/tasks/import_job_csv.rake 0 → 100644
    1 require "csv"
    2
    3 namespace :import_job_csv do
    4 desc "Import CSV file into database"
    5 task create_job: :environment do
    6 file = "db/Venjob.csv"
    7 CSV.foreach(file, headers: true) do |row|
    8 job_hash = row.to_hash
    9 job = Job.where(id: job_hash["id"])
    • Van Hau Le @haulv commented Dec 10, 2019
      Master

      @hoangds use Job.find_by(id: job_hash["id"]) hoặc find_by_id nhé E

      Edited Dec 10, 2019 by Van Hau Le
      @hoangds use Job.find_by(id: job_hash["id"]) hoặc find_by_id nhé E
    • Đường Sỹ Hoàng @hoangds

      changed this line in version 2 of the diff

      Dec 10, 2019

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4449&start_sha=fcc712c52ec04125aaa28512008d30aba22dd8b5#9b001ac4af0484ae9bfa4e24b31a882de5a68a53_9_5)
      Toggle commit list
    Please register or sign in to reply
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Dec 10, 2019
    Last updated by Đường Sỹ Hoàng Dec 10, 2019
    lib/tasks/import_job_csv.rake 0 → 100644
    1 require "csv"
    2
    3 namespace :import_job_csv do
    4 desc "Import CSV file into database"
    5 task create_job: :environment do
    6 file = "db/Venjob.csv"
    • Van Hau Le @haulv commented Dec 10, 2019
      Master

      @hoangds file path nên là 1 config trong yml hoặc param truyền vào, không fix cứng trong này nhé!

      @hoangds file path nên là 1 config trong yml hoặc param truyền vào, không fix cứng trong này nhé!
    • Đường Sỹ Hoàng @hoangds

      changed this line in version 2 of the diff

      Dec 10, 2019

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4449&start_sha=fcc712c52ec04125aaa28512008d30aba22dd8b5#9b001ac4af0484ae9bfa4e24b31a882de5a68a53_6_5)
      Toggle commit list
    Please register or sign in to reply
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Dec 10, 2019
    Last updated by Đường Sỹ Hoàng Dec 10, 2019
    lib/tasks/import_job_csv.rake 0 → 100644
    1 require "csv"
    2
    3 namespace :import_job_csv do
    4 desc "Import CSV file into database"
    5 task create_job: :environment do
    6 file = "db/Venjob.csv"
    • Van Hau Le @haulv commented Dec 10, 2019
      Master

      @hoangds file path nên là 1 config trong yml hoặc param truyền vào, không fix cứng trong này nhé!

      @hoangds file path nên là 1 config trong yml hoặc param truyền vào, không fix cứng trong này nhé!
    • Đường Sỹ Hoàng @hoangds

      changed this line in version 2 of the diff

      Dec 10, 2019

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4449&start_sha=fcc712c52ec04125aaa28512008d30aba22dd8b5#9b001ac4af0484ae9bfa4e24b31a882de5a68a53_6_5)
      Toggle commit list
    Please register or sign in to reply
  • Van Hau Le
    @haulv started a discussion on the diff Dec 10, 2019
    Resolved by Son Do Hong Dec 11, 2019
    lib/tasks/import_job_csv.rake 0 → 100644
    11 job.first.update_attributes(job_hash)
    12 else
    13 Job.create!({
    14 company_id: row[4],
    15 company_name: row[5],
    16 location: row[16],
    17 title: row[9],
    18 description: row[7],
    19 position: row[8],
    20 salary: row[11],
    21 requirement: row[10]
    22 })
    23 end
    24 end
    25 end
    26 end
    • Van Hau Le @haulv commented Dec 10, 2019
      Master

      @hoangds Có thể xem xét catch exception để skip row import hoặc rollback toàn bộ, tránh trường hợp chạy bị lỗi 1 2 dòng phải chạy đi chạy lại những dòng đã được import!

      @hoangds Có thể xem xét catch exception để skip row import hoặc rollback toàn bộ, tránh trường hợp chạy bị lỗi 1 2 dòng phải chạy đi chạy lại những dòng đã được import!
    Please register or sign in to reply
  • Đường Sỹ Hoàng @hoangds

    added 1 commit

    • 09737968 - Merge tasks

    Compare with previous version

    Dec 10, 2019

    added 1 commit

    • 09737968 - Merge tasks

    Compare with previous version

    added 1 commit * 09737968 - Merge tasks [Compare with previous version](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4449&start_sha=fcc712c52ec04125aaa28512008d30aba22dd8b5)
    Toggle commit list
  • Đường Sỹ Hoàng @hoangds

    added 1 commit

    • 57c5bab7 - Added rescue

    Compare with previous version

    Dec 11, 2019

    added 1 commit

    • 57c5bab7 - Added rescue

    Compare with previous version

    added 1 commit * 57c5bab7 - Added rescue [Compare with previous version](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4450&start_sha=097379686ac596da564585bdd06d645e29320ea8)
    Toggle commit list
  • Đường Sỹ Hoàng @hoangds

    added 1 commit

    • 86bdeff2 - Deleted Helper

    Compare with previous version

    Dec 11, 2019

    added 1 commit

    • 86bdeff2 - Deleted Helper

    Compare with previous version

    added 1 commit * 86bdeff2 - Deleted Helper [Compare with previous version](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4451&start_sha=57c5bab7663da3c079f30aaed1ee5f35ee529801)
    Toggle commit list
  • Son Do Hong
    @sondh started a discussion on an old version of the diff Dec 11, 2019
    Last updated by Đường Sỹ Hoàng Dec 11, 2019
    lib/tasks/import_job_csv.rake 0 → 100644
    1 require "csv"
    2
    3 namespace :import_job_csv do
    • Son Do Hong @sondh commented Dec 11, 2019
      Master

      namespace nên để là job tên task nên để là import_csv

      namespace nên để là job tên task nên để là import_csv
    • Đường Sỹ Hoàng @hoangds

      changed this line in version 5 of the diff

      Dec 11, 2019

      changed this line in version 5 of the diff

      changed this line in [version 5 of the diff](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4452&start_sha=86bdeff270b55b3bb1c649b7d180b6189b42ea8e#9b001ac4af0484ae9bfa4e24b31a882de5a68a53_3_3)
      Toggle commit list
    Please register or sign in to reply
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Dec 11, 2019
    Last updated by Đường Sỹ Hoàng Dec 11, 2019
    lib/tasks/import_job_csv.rake 0 → 100644
    14 rescue
    15 import_company_logger = ActiveSupport::Logger.new("log/import_company.log")
    16 import_company_logger.info "Skip #{row}"
    17 next
    18 job_params = {
    19 company_id: Company.find_by(code: row["Company id"]).id,
    20 location: row["Work place"],
    21 title: row["Name"],
    22 description: row["Description"],
    23 position: row["Level"],
    24 salary: row["Salary"],
    25 requirement: row["Requirement"]
    26 }
    27 Job.create!(job_params)
    28 rescue
    29 import_company_logger = ActiveSupport::Logger.new("log/import_job.log")
    • Van Hau Le @haulv commented Dec 11, 2019
      Master

      @hoangds sao có tới 2 rescue vậy em? tham khảo logger và error handling bên dưới nhé em

      https://stackify.com/rails-logger-and-rails-logging-best-practices/

      https://medium.com/rails-ember-beyond/error-handling-in-rails-the-modular-way-9afcddd2fe1b

      Edited Dec 11, 2019 by Van Hau Le
      @hoangds sao có tới 2 rescue vậy em? tham khảo logger và error handling bên dưới nhé em https://stackify.com/rails-logger-and-rails-logging-best-practices/ https://medium.com/rails-ember-beyond/error-handling-in-rails-the-modular-way-9afcddd2fe1b
    • Đường Sỹ Hoàng @hoangds

      changed this line in version 5 of the diff

      Dec 11, 2019

      changed this line in version 5 of the diff

      changed this line in [version 5 of the diff](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4452&start_sha=86bdeff270b55b3bb1c649b7d180b6189b42ea8e#9b001ac4af0484ae9bfa4e24b31a882de5a68a53_29_23)
      Toggle commit list
    Please register or sign in to reply
  • Đường Sỹ Hoàng @hoangds

    added 1 commit

    • bacb7c56 - Fix error handler

    Compare with previous version

    Dec 11, 2019

    added 1 commit

    • bacb7c56 - Fix error handler

    Compare with previous version

    added 1 commit * bacb7c56 - Fix error handler [Compare with previous version](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4452&start_sha=86bdeff270b55b3bb1c649b7d180b6189b42ea8e)
    Toggle commit list
  • Đường Sỹ Hoàng @hoangds

    added 1 commit

    • e1e676c8 - Fix identation

    Compare with previous version

    Dec 11, 2019

    added 1 commit

    • e1e676c8 - Fix identation

    Compare with previous version

    added 1 commit * e1e676c8 - Fix identation [Compare with previous version](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4453&start_sha=bacb7c565a8f429eba4c2e9b89fee92e9266fba3)
    Toggle commit list
  • Đường Sỹ Hoàng @hoangds

    added 1 commit

    • 164d7f0e - Config setting

    Compare with previous version

    Dec 11, 2019

    added 1 commit

    • 164d7f0e - Config setting

    Compare with previous version

    added 1 commit * 164d7f0e - Config setting [Compare with previous version](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4454&start_sha=e1e676c8b60cad0dfcb7cd13c7ce517914bfc827)
    Toggle commit list
  • Đường Sỹ Hoàng @hoangds

    added 1 commit

    • 0dea1595 - Added company_id

    Compare with previous version

    Dec 11, 2019

    added 1 commit

    • 0dea1595 - Added company_id

    Compare with previous version

    added 1 commit * 0dea1595 - Added company_id [Compare with previous version](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4455&start_sha=164d7f0e0e515b2a83be98d15e6cb2d2b1e06ad5)
    Toggle commit list
  • Son Do Hong
    @sondh started a discussion on an old version of the diff Dec 11, 2019
    Last updated by Đường Sỹ Hoàng Dec 11, 2019
    lib/tasks/import_job_csv.rake 0 → 100644
    3 namespace :job do
    4 desc "Import CSV file into database"
    5 task import_csv: :environment do
    6 csv_file = Settings.import_job.csv_file
    7 CSV.foreach(csv_file, headers: true) do |row|
    8 company_params = {
    9 email: row["contact email"],
    10 name: row["company name"],
    11 address: row["company address"],
    12 code: row["company id"]
    13 }
    14 company = Company.find_or_initialize_by(code: row["company id"])
    15 company.update(company_params)
    16
    17 job_params = {
    18 company_id: company.id,
    • Son Do Hong @sondh commented Dec 11, 2019
      Master

      bỏ trường này đi, k cần tới

      bỏ trường này đi, k cần tới
    • Đường Sỹ Hoàng @hoangds

      changed this line in version 9 of the diff

      Dec 11, 2019

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4456&start_sha=0dea1595be1db1431f90b273d4bea5a3be6191d1#9b001ac4af0484ae9bfa4e24b31a882de5a68a53_18_18)
      Toggle commit list
    Please register or sign in to reply
  • Đường Sỹ Hoàng @hoangds

    added 1 commit

    • 05c8d277 - Deleted company id

    Compare with previous version

    Dec 11, 2019

    added 1 commit

    • 05c8d277 - Deleted company id

    Compare with previous version

    added 1 commit * 05c8d277 - Deleted company id [Compare with previous version](https://gitlab.zigexn.vn/hoangds/VenJob/merge_requests/3/diffs?diff_id=4456&start_sha=0dea1595be1db1431f90b273d4bea5a3be6191d1)
    Toggle commit list
  • Son Do Hong @sondh

    mentioned in commit 79a857e7

    Dec 11, 2019

    mentioned in commit 79a857e7

    mentioned in commit 79a857e77f6c0770ea97affd71db75063c17ec35
    Toggle commit list
  • Son Do Hong @sondh

    merged

    Dec 11, 2019

    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
Son Do Hong
Assignee
Son Do Hong @sondh
Assign to
None
Milestone
None
Assign milestone
Time tracking
3
3 participants
Reference: hoangds/VenJob!3
×

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.