Fix review 11/05/2020
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/fix_review_11_5_2020 origin/feature/fix_review_11_5_2020
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/fix_review_11_5_2020
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.
-
Trịnh Hoàng Phúc @phucth
added 1 commit
- 079c82d0 - Add service for crawler
added 1 commit * 079c82d0 - Add service for crawler [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4803&start_sha=9b293818a54abacb538f2c3e1fe233dbe9b9d0a7)Toggle commit list -
9 exception_logger = Logger.new("log/exception_logger.log") 10 10 11 11 # Define skip logger 12 skip_url_logger = ActiveSupport::Logger.new("log/skip_url_logger.log") 12 skip_url_logger = Logger.new("log/skip_url_logger.log") 13 13 14 14 # Loop page 15 (10..12).each do |page| 15 (1..2).each do |page| 16 16 # Fetch and parse HTML document 17 html_jobs = Nokogiri::HTML.parse(open("https://careerbuilder.vn/viec-lam/tat-ca-viec-lam-trang-#{page}-vi.html")) 18 17 html_jobs = Nokogiri::HTML.parse(URI.open("https://careerbuilder.vn/viec-lam/tat-ca-viec-lam-trang-#{page}-vi.html")) 19 18 # Loop item 20 19 html_jobs.css(".jobs-side-list .job-item").each do |item| 20 # Set salary, min-salary, max-salary -
phuctmZigexn @phuctm commentedEdited by phuctmZigexn
mình nên check template xem có đúng hay không rồi hãy lấy data. tránh việc lấy xong lại không đúng template
html_job_detail = Nokogiri::HTML.parse(URI.open(URI.encode(item.css(".figure .figcaption .title .job_link @href").text))) if html_job_detail.at_css(".search-result-list-detail .tabs div#tab-1").nil? logger.warn "Another template #{html_job_detail}" next endmình nên check template xem có đúng hay không rồi hãy lấy data. tránh việc lấy xong lại không đúng template ` html_job_detail = Nokogiri::HTML.parse(URI.open(URI.encode(item.css(".figure .figcaption .title .job_link @href").text))) if html_job_detail.at_css(".search-result-list-detail .tabs div#tab-1").nil? logger.warn "Another template #{html_job_detail}" next end `
Please register or sign in to reply -
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
1 class AddColumnsToJobs < ActiveRecord::Migration[6.0] 2 def change 3 add_column :jobs, :min_salary, :bigint, :default => 0 -
phuctmZigexn @phuctm commentedEdited
:default => 0cú pháp cũ. đổi thànhdefault: 0`:default => 0` cú pháp cũ. đổi thành `default: 0` -
Trịnh Hoàng Phúc @phucth
changed this line in version 4 of the diff
changed this line in version 4 of the diff
changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4806&start_sha=db3ba1fbe4361b6166dbdbd0d36017a3bf33be08#136565ed6a1c20365d1dd46d09f6ed2851091681_3_3)Toggle commit list
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
11 11 # Define skip logger 12 skip_url_logger = ActiveSupport::Logger.new("log/skip_url_logger.log") 12 skip_url_logger = Logger.new("log/skip_url_logger.log") 13 13 14 14 # Loop page 15 (10..12).each do |page| 15 (1..2).each do |page| 16 16 # Fetch and parse HTML document 17 html_jobs = Nokogiri::HTML.parse(open("https://careerbuilder.vn/viec-lam/tat-ca-viec-lam-trang-#{page}-vi.html")) 18 17 html_jobs = Nokogiri::HTML.parse(URI.open("https://careerbuilder.vn/viec-lam/tat-ca-viec-lam-trang-#{page}-vi.html")) 19 18 # Loop item 20 19 html_jobs.css(".jobs-side-list .job-item").each do |item| 20 # Set salary, min-salary, max-salary 21 salary = item.at_css(".figure .figcaption .caption .salary").text.gsub("$ ","") 22 if salary == "Cạnh tranh" -
phuctmZigexn @phuctm commentedEdited
tạo crawl_service có class method
convert_salaryvà move logic salary này vào. ví dụ:def self.convert_salary(salary) if salary == "Cạnh tranh" [0, 999999999] elsif salary.include? "Dưới" max_salary = (salary.gsub("Dưới ","").gsub(" Tr VND","").gsub(",",".").to_f*1000000).to_i [0, max_salary] elsif salary.include? "Trên" min_salary = (salary.gsub("Trên ","").gsub(" Tr VND","").gsub(",",".").to_f*1000000).to_i max_salary = 999999999 [min_salary, max_salary] else range_salary = salary.split("-") min_salary = (range_salary[0].gsub("$ ","").gsub(" Tr ","").to_f*1000000).to_i max_salary = (range_salary[1].gsub(" Tr VND","").gsub(" ","").to_f*1000000).to_i [min_salary, max_salary] end endtạo crawl_service có class method `convert_salary` và move logic salary này vào. ví dụ: ` def self.convert_salary(salary) if salary == "Cạnh tranh" [0, 999999999] elsif salary.include? "Dưới" max_salary = (salary.gsub("Dưới ","").gsub(" Tr VND","").gsub(",",".").to_f*1000000).to_i [0, max_salary] elsif salary.include? "Trên" min_salary = (salary.gsub("Trên ","").gsub(" Tr VND","").gsub(",",".").to_f*1000000).to_i max_salary = 999999999 [min_salary, max_salary] else range_salary = salary.split("-") min_salary = (range_salary[0].gsub("$ ","").gsub(" Tr ","").to_f*1000000).to_i max_salary = (range_salary[1].gsub(" Tr VND","").gsub(" ","").to_f*1000000).to_i [min_salary, max_salary] end end ` -
phuctmZigexn @phuctm commentedEdited
ở task crawler sẽ là:
min_salary, max_salary = CrawlerService.convert_salary(salary)ở task crawler sẽ là: `min_salary, max_salary = CrawlerService.convert_salary(salary)` -
Trịnh Hoàng Phúc @phucth
changed this line in version 3 of the diff
changed this line in version 3 of the diff
changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4805&start_sha=079c82d0dc071757c4abe4f7945cf3181937efda#b321b772986de9dfe9db0ed4138ae166e577f241_22_24)Toggle commit list
-
-
3 3 4 4 namespace :crawler do 5 5 desc "Crawler Careerbuilder" 6 6 7 7 task job: :environment do 8 8 # Define exception logger 9 exception_logger = ActiveSupport::Logger.new("log/exception_logger.log") -
phuctmZigexn @phuctm commentedEdited by phuctmZigexn
anh nghĩ là nên tạo 1 log cho crawler thôi cho tiện theo dõi. ví dụ:
logger = Logger.new("log/crawler.log")và dùng các level của log để log thông tin. ví dụ
- crawl thành công thì dùng
logger.info "Success: #{url}" - khác template
logger.warn "Another template: #{url}" - exception:
logger.error "Error: #{url} \n Message: #{message}"
Reference: https://stackify.com/rails-logger-and-rails-logging-best-practices/
anh nghĩ là nên tạo 1 log cho crawler thôi cho tiện theo dõi. ví dụ: `logger = Logger.new("log/crawler.log")` và dùng các level của log để log thông tin. ví dụ 1. crawl thành công thì dùng `logger.info "Success: #{url}"` 2. khác template `logger.warn "Another template: #{url}"` 3. exception: `logger.error "Error: #{url} \n Message: #{message}"` Reference: https://stackify.com/rails-logger-and-rails-logging-best-practices/ - crawl thành công thì dùng
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
45 title: html_company_detail.css(".jobsby-company .company-introduction .company-info .info .content .name").text, 46 address: html_company_detail.css(".jobsby-company .company-introduction .company-info .info .content p")[1].text, 47 logo: html_company_detail.css(".jobsby-company .company-introduction .company-info .info .img @src").text, 48 description: html_company_detail.css(".jobsby-company .company-introduction .company-info .info .content ul").inner_html.strip 49 } 50 # Check exist or create company 51 job_attributes[:company_id] = check_exist_or_create_company(company_attributes) 52 end 53 end 54 44 # Defind industry ids array 55 45 industries = [] 56 46 57 html_job_detail = Nokogiri::HTML.parse(open(URI.encode(item.css(".figure .figcaption .title .job_link @href").text))) 58 unless html_job_detail.at_css(".search-result-list-detail").nil? 47 html_job_detail = Nokogiri::HTML.parse(URI.open(URI.encode(item.css(".figure .figcaption .title .job_link @href").text))) 48 if html_job_detail.at_css(".search-result-list-detail .container .no-gutters").present? -
phuctmZigexn @phuctm commentedEdited
vì đã check template ở trên nên không cần check chỗ này nữa
vì đã check template ở trên nên không cần check chỗ này nữa -
Trịnh Hoàng Phúc @phucth
changed this line in version 3 of the diff
changed this line in version 3 of the diff
changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4805&start_sha=079c82d0dc071757c4abe4f7945cf3181937efda#b321b772986de9dfe9db0ed4138ae166e577f241_48_33)Toggle commit list
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
74 108 end 75 # Get description for job attributes 76 description = "" 77 109 78 html_job_detail.css(".search-result-list-detail .tabs #tab-1 .job-detail-content .detail-row").each do |ele| 79 description << ele.inner_html 110 if industries.length > 0 111 industries.each do |industry| 112 job.industries << industry 113 end 80 114 end 81 # Set description for job attributes 82 job_attributes[:job_description] = description.strip 83 115 else 84 skip_url_logger.info "another template #{item.css(".figure .figcaption .title .job_link @href").text}" 116 skip_url_logger.info "another template #{item.at_css(".figure .figcaption .title .job_link @href").text}" -
phuctmZigexn @phuctm commentedEdited
vì đã log lại ở trên thì chô này cũng không cần nheeeee
vì đã log lại ở trên thì chô này cũng không cần nheeeee -
Trịnh Hoàng Phúc @phucth
changed this line in version 3 of the diff
changed this line in version 3 of the diff
changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4805&start_sha=079c82d0dc071757c4abe4f7945cf3181937efda#b321b772986de9dfe9db0ed4138ae166e577f241_116_98)Toggle commit list
-
-
87 job = check_exist_or_create_job(job_attributes) 88 # Create city_job 89 if cities.count > 0 90 cities.each do |city| 91 job.cities << city 92 end 93 end 94 # Create industry_job 95 if industries.count > 0 96 industries.each do |industry| 97 job.industries << industry 98 end 99 end 100 rescue 101 exception_logger.info "Error url: #{item.css(".figure .figcaption .title .job_link @href").text}" 118 rescue Exception => e -
phuctmZigexn @phuctm commentedEdited
thay thế bằng logger.fail nếu tạo record có lỗi (validate.....)
thay thế bằng logger.fail nếu tạo record có lỗi (validate.....)
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
1 1 class Job < ApplicationRecord 2 validates :title, presence: true -
phuctmZigexn @phuctm commentedEdited by phuctmZigexn
thêm validate cho những fields khác. Tham khảo code style này (thứ tự của validation, association, scope các kiểu trong model): https://github.com/rubocop-hq/rails-style-guide#macro-style-methods
salary: phải là integer
title: length, minimum là 6 chữ.
thử áp dụng validate presence cho nhiều field cùng lúc (updated_date_job, expiration_date, salary, years_of_experience) validate cho updated_date_job < expiration_date
thêm validate cho những fields khác. Tham khảo code style này (thứ tự của validation, association, scope các kiểu trong model): https://github.com/rubocop-hq/rails-style-guide#macro-style-methods salary: phải là integer title: length, minimum là 6 chữ. thử áp dụng validate presence cho nhiều field cùng lúc (updated_date_job, expiration_date, salary, years_of_experience) validate cho updated_date_job < expiration_date -
Trịnh Hoàng Phúc @phucth
changed this line in version 3 of the diff
changed this line in version 3 of the diff
changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4805&start_sha=079c82d0dc071757c4abe4f7945cf3181937efda#742abd5cbc2b12d2da315862ace6297c7d6dcb87_2_2)Toggle commit list
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
1 1 class City < ApplicationRecord 2 validates :title, presence: true -
phuctmZigexn @phuctm commentedEdited
nên thêm validate uniqness không ta, tránh việc có rồi ko tạo thêm nữa.
nên thêm validate uniqness không ta, tránh việc có rồi ko tạo thêm nữa. -
Trịnh Hoàng Phúc @phucth
changed this line in version 3 of the diff
changed this line in version 3 of the diff
changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4805&start_sha=079c82d0dc071757c4abe4f7945cf3181937efda#28495972e963898abf2919ffeaeb92fbdf49fb8e_2_2)Toggle commit list
-
-
1 1 class Company < ApplicationRecord 2 validates :title, presence: true -
phuctmZigexn @phuctm commentedEdited
nên thêm validate uniqness không ta, tránh việc có rồi ko tạo thêm nữa.
nên thêm validate uniqness không ta, tránh việc có rồi ko tạo thêm nữa.
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
1 1 class Industry < ApplicationRecord 2 validates :title, presence: true -
phuctmZigexn @phuctm commentedEdited
nên thêm validate uniqness không ta, tránh việc có rồi ko tạo thêm nữa.
nên thêm validate uniqness không ta, tránh việc có rồi ko tạo thêm nữa. -
Trịnh Hoàng Phúc @phucth
changed this line in version 3 of the diff
changed this line in version 3 of the diff
changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4805&start_sha=079c82d0dc071757c4abe4f7945cf3181937efda#6fd7ec4bda80a3376d591b3e766bce8bf035c4c6_2_2)Toggle commit list
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúcapp/services/city_service.rb 0 → 100644
1 class CityService 2 def import cities 3 City.import cities 4 end 5 6 def check_exist_or_create_city city_title 7 cities = City.where("title LIKE ?", city_title) -
phuctmZigexn @phuctm commentedEdited
đổi lại thành
find_or_createđổi lại thành `find_or_create` -
Trịnh Hoàng Phúc @phucth
changed this line in version 3 of the diff
changed this line in version 3 of the diff
changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4805&start_sha=079c82d0dc071757c4abe4f7945cf3181937efda#78dbc939de4cc59b08389dabe5550159bee3c5d0_7_0)Toggle commit list
-
-
Trịnh Hoàng Phúc @phucth
added 1 commit
- db3ba1fb - Fix review 12/05/2020
added 1 commit * db3ba1fb - Fix review 12/05/2020 [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4805&start_sha=079c82d0dc071757c4abe4f7945cf3181937efda)Toggle commit list -
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
10 16 has_and_belongs_to_many :industries 11 17 has_and_belongs_to_many :cities 12 18 13 scope :by_cities, -> (city_id) {includes(:cities).where("cities.id = ?", city_id).references(:cities)} 14 scope :by_industries, -> (industry_id) {includes(:industries).where("industries.id = ?", industry_id).references(:industries)} 15 scope :by_companies, -> (company_id) {where("company_id = #{company_id}")} 19 validate :updated_date_job_cannot_be_greater_than_expiration_date, on: :create 20 21 validates :title, length: { minimum: 6 } 22 validates :title, :updated_date_job, :level, :expiration_date, :salary, :min_salary, :max_salary, presence: true, on: :create -
phuctmZigexn @phuctm commentedEdited
on: :create=> cái này mình ko cần đâu, vì validates nó sẽ auto cho create/save`on: :create` => cái này mình ko cần đâu, vì validates nó sẽ auto cho create/save -
Trịnh Hoàng Phúc @phucth
changed this line in version 4 of the diff
changed this line in version 4 of the diff
changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4806&start_sha=db3ba1fbe4361b6166dbdbd0d36017a3bf33be08#742abd5cbc2b12d2da315862ace6297c7d6dcb87_22_22)Toggle commit list
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
10 16 has_and_belongs_to_many :industries 11 17 has_and_belongs_to_many :cities 12 18 13 scope :by_cities, -> (city_id) {includes(:cities).where("cities.id = ?", city_id).references(:cities)} 14 scope :by_industries, -> (industry_id) {includes(:industries).where("industries.id = ?", industry_id).references(:industries)} 15 scope :by_companies, -> (company_id) {where("company_id = #{company_id}")} 19 validate :updated_date_job_cannot_be_greater_than_expiration_date, on: :create -
phuctmZigexn @phuctm commentedEdited
on: :create=> cái này ko cần nè`on: :create` => cái này ko cần nè -
Trịnh Hoàng Phúc @phucth
changed this line in version 4 of the diff
changed this line in version 4 of the diff
changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4806&start_sha=db3ba1fbe4361b6166dbdbd0d36017a3bf33be08#742abd5cbc2b12d2da315862ace6297c7d6dcb87_19_19)Toggle commit list
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúcapp/services/crawler_service.rb 0 → 100644
1 class CrawlerService 2 def self.convert_salary salary 3 if salary == "Cạnh tranh" 4 [0, 999999999] 5 elsif salary.include? "Dưới" 6 max_salary = (salary.gsub("Dưới ","").gsub(" Tr VND","").gsub(",",".").to_f*1000000).to_i -
phuctmZigexn @phuctm commentedEdited
anh chợt nhớ ra, dùng
trsẽ nhanh hơngsub=))) https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-codecó chút nhỏ khác gsub xíu https://apidock.com/ruby/String/tr
anh chợt nhớ ra, dùng `tr` sẽ nhanh hơn `gsub` =))) https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code có chút nhỏ khác gsub xíu https://apidock.com/ruby/String/tr -
Trịnh Hoàng Phúc @phucth
changed this line in version 4 of the diff
changed this line in version 4 of the diff
changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4806&start_sha=db3ba1fbe4361b6166dbdbd0d36017a3bf33be08#19d431b8cc163ab4bd5ada1e18677b88db8b3292_6_2)Toggle commit list
-
-
app/services/crawler_service.rb 0 → 100644
4 [0, 999999999] 5 elsif salary.include? "Dưới" 6 max_salary = (salary.gsub("Dưới ","").gsub(" Tr VND","").gsub(",",".").to_f*1000000).to_i 7 [0, max_salary] 8 elsif salary.include? "Trên" 9 min_salary = (salary.gsub("Trên ","").gsub(" Tr VND","").gsub(",",".").to_f*1000000).to_i 10 max_salary = 999999999 11 [min_salary, max_salary] 12 else 13 range_salary = salary.split("-") 14 min_salary = (range_salary[0].gsub("$ ","").gsub(" Tr ","").to_f*1000000).to_i 15 max_salary = (range_salary[1].gsub(" Tr VND","").gsub(" ","").to_f*1000000).to_i 16 [min_salary, max_salary] 17 end 18 end 19 end -
phuctmZigexn @phuctm commentedEdited by phuctmZigexn
anh có refactor lại method này theo kiểu khác. Em tham khảo qua nha
def self.convert_salary salary # format [min_salary, max_salary] return [0, 999_999_999] if salary == "Cạnh tranh" # extract number from string vn_salary = salary.tr("^[0-9]{1,2}[.,]\d{1-2}", " ") .tr(",",".") .split(" ") .map { |s| (s.to_f*1_000_000).to_i } return [0, vn_salary[0]] if salary.include? "Dưới" return [vn_salary[0], 0] if salary.include? "Trên" [vn_salary[0], vn_salary[1]] endanh có refactor lại method này theo kiểu khác. Em tham khảo qua nha ``` def self.convert_salary salary # format [min_salary, max_salary] return [0, 999_999_999] if salary == "Cạnh tranh" # extract number from string vn_salary = salary.tr("^[0-9]{1,2}[.,]\d{1-2}", " ") .tr(",",".") .split(" ") .map { |s| (s.to_f*1_000_000).to_i } return [0, vn_salary[0]] if salary.include? "Dưới" return [vn_salary[0], 0] if salary.include? "Trên" [vn_salary[0], vn_salary[1]] end ```
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
37 cities << city 33 html_job_detail.css(".search-result-list-detail .tabs #tab-1 .job-detail-content .has-background ul li").each do |ele| 34 type = ele.at_css("strong").text 35 case type 36 when "Hết hạn nộp" 37 job_attributes[:expiration_date] = ele.at_css("p").text.squish 38 when "Cấp bậc" 39 job_attributes[:level] = ele.at_css("p").text.squish 40 when "Kinh nghiệm" 41 job_attributes[:years_of_experience] = ele.at_css("p").text.squish 42 end 38 43 end 39 40 if item.css(".figure .image a @href").text != "javascript:void(0);" 44 html_job_detail.css(".search-result-list-detail .tabs #tab-1 .job-detail-content .detail-row").each do |ele| 45 if ele.at_css("h3").present? -
phuctmZigexn @phuctm commentedEdited by phuctmZigexn
anh thấy mình ko cần check điều kiện này đâu, với mình nên dựa vào class thì hay hơn dựa vào thẻ tag đó
next if ele.at_css(".detail-title").nil?type = ele.at_css(".detail-title").textanh thấy mình ko cần check điều kiện này đâu, với mình nên dựa vào class thì hay hơn dựa vào thẻ tag đó `next if ele.at_css(".detail-title").nil?` `type = ele.at_css(".detail-title").text` -
Trịnh Hoàng Phúc @phucth
changed this line in version 4 of the diff
changed this line in version 4 of the diff
changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4806&start_sha=db3ba1fbe4361b6166dbdbd0d36017a3bf33be08#b321b772986de9dfe9db0ed4138ae166e577f241_45_49)Toggle commit list
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
80 71 end 81 # Set description for job attributes 82 job_attributes[:job_description] = description.strip 83 else 84 skip_url_logger.info "another template #{item.css(".figure .figcaption .title .job_link @href").text}" 85 72 end 86 73 # Create job 87 job = check_exist_or_create_job(job_attributes) 74 job = JobService.check_exist_or_create_job job_attributes 75 if job.errors.full_messages.present? 76 logger.error "#{job.errors.full_messages.join(",")}" 77 next 78 end 79 # Defind cities array 80 cities = item.css(".figure .figcaption .caption .location ul li").map do |city| 81 city = City.find_or_create_by({title: city.text.squish}) -
phuctmZigexn @phuctm commentedEdited
city ==> dư nè`city =` => dư nè -
Trịnh Hoàng Phúc @phucth
changed this line in version 4 of the diff
changed this line in version 4 of the diff
changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4806&start_sha=db3ba1fbe4361b6166dbdbd0d36017a3bf33be08#b321b772986de9dfe9db0ed4138ae166e577f241_81_74)Toggle commit list
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
28 expiration_date: nil, 29 job_description: nil, 30 company_id: nil, 27 title: item.at_css(".figure .figcaption .title a @title").text, 28 updated_date_job: item.at_css(".bottom-right-icon .time time").text, 29 salary: salary, 30 min_salary: min_salary, 31 max_salary: max_salary 31 32 } 32 # Defind cities array 33 cities = [] 34 35 item.css(".figure .figcaption .caption .location ul li").each do |city| 36 city = check_exist_or_create_city(city.text.strip) 37 cities << city 33 html_job_detail.css(".search-result-list-detail .tabs #tab-1 .job-detail-content .has-background ul li").each do |ele| -
phuctmZigexn @phuctm commentedEdited
html_job_detail.css(".job-detail-content .row .has-background ul li").each do |ele|`html_job_detail.css(".job-detail-content .row .has-background ul li").each do |ele|` -
Trịnh Hoàng Phúc @phucth
changed this line in version 4 of the diff
changed this line in version 4 of the diff
changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4806&start_sha=db3ba1fbe4361b6166dbdbd0d36017a3bf33be08#b321b772986de9dfe9db0ed4138ae166e577f241_33_37)Toggle commit list
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffResolved by Trịnh Hoàng Phúc
77 next 78 end 79 # Defind cities array 80 cities = item.css(".figure .figcaption .caption .location ul li").map do |city| 81 city = City.find_or_create_by({title: city.text.squish}) 82 end 88 83 # Create city_job 89 if cities.count > 0 84 if cities.length > 0 90 85 cities.each do |city| 91 86 job.cities << city 92 87 end 93 88 end 89 # Defind industries array 90 industries = html_job_detail.css(".search-result-list-detail .tabs #tab-1 .job-detail-content .detail-box .industry p a").map do |ele| 91 industry = Industry.find_or_create_by({title: ele.text.gsub(",","").squish}) -
phuctmZigexn @phuctm commentedEdited
industry =dư nè`industry = ` dư nè -
Trịnh Hoàng Phúc @phucth
changed this line in version 4 of the diff
changed this line in version 4 of the diff
changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4806&start_sha=db3ba1fbe4361b6166dbdbd0d36017a3bf33be08#b321b772986de9dfe9db0ed4138ae166e577f241_91_77)Toggle commit list
-
-
phuctmZigexn@phuctm started a discussion on an old version of the diffLast updated by Trịnh Hoàng Phúc
44 html_job_detail.css(".search-result-list-detail .tabs #tab-1 .job-detail-content .detail-row").each do |ele| 45 if ele.at_css("h3").present? 46 type = ele.at_css("h3").text 47 case type 48 when "Phúc lợi " 49 job_attributes[:benefit] = ele.at_css("ul").inner_html.squish 50 when "Mô tả Công việc" 51 job_attributes[:job_description] = ele.inner_html.squish.gsub("<h3 class=\"detail-title\">Mô tả Công việc</h3>","") 52 when "Yêu Cầu Công Việc" 53 job_attributes[:job_requirements] = ele.inner_html.squish.gsub("<h3 class=\"detail-title\">Yêu Cầu Công Việc</h3>","") 54 when "Thông tin khác" 55 job_attributes[:other_information] = ele.inner_html.squish.gsub("<h3 class=\"detail-title\">Thông tin khác</h3>","") 56 end 57 end 58 end 59 if item.at_css(".figure .image a @href").text != "javascript:void(0);" -
phuctmZigexn @phuctm commentedEdited
dòng này cần thiết ko
dòng này cần thiết ko -
Trịnh Hoàng Phúc @phucth commentedMaster
dạ dòng này để check xem job có company hay ko, do bên
careerbuildercó job ko có company em update code sẽnextnếu rơi vô case này rồi anhdạ dòng này để check xem job có company hay ko, do bên `careerbuilder` có job ko có company em update code sẽ `next` nếu rơi vô case này rồi anh -
Trịnh Hoàng Phúc @phucth
changed this line in version 4 of the diff
changed this line in version 4 of the diff
changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4806&start_sha=db3ba1fbe4361b6166dbdbd0d36017a3bf33be08#b321b772986de9dfe9db0ed4138ae166e577f241_59_49)Toggle commit list
-
-
Trịnh Hoàng Phúc @phucth
resolved all discussions
resolved all discussions
resolved all discussionsToggle commit list -
Trịnh Hoàng Phúc @phucth
added 1 commit
- b7c9fd57 - Fix review 13/05/2020
added 1 commit * b7c9fd57 - Fix review 13/05/2020 [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4806&start_sha=db3ba1fbe4361b6166dbdbd0d36017a3bf33be08)Toggle commit list -
Trịnh Hoàng Phúc @phucth
added 1 commit
- 15b33b8c - Fix review 13/05/2020.2
added 1 commit * 15b33b8c - Fix review 13/05/2020.2 [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4807&start_sha=b7c9fd57411eefe117bf5820ad952a3cf5309ab7)Toggle commit list -
Trịnh Hoàng Phúc @phucth
added 1 commit
- 2e086f87 - Fix review 14/05/2020
added 1 commit * 2e086f87 - Fix review 14/05/2020 [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/17/diffs?diff_id=4810&start_sha=15b33b8cab447552a18196a087a48b0ea779ccc9)Toggle commit list -
Trịnh Hoàng Phúc @phucth
mentioned in commit ab24f6a1
mentioned in commit ab24f6a1
mentioned in commit ab24f6a1fd265b72d758026033a2fdb3a42252a5Toggle commit list -
Trịnh Hoàng Phúc @phucth
merged
merged
mergedToggle commit list