Create Industry list
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
-
Toggle commit list
-
1 1 class CitiesController < ApplicationController 2 2 def index 3 @cities_vietnam = City.all_city.where('location = 1') 4 @cities_international = City.all_city.where('location = 0') 3 @cities_vietnam = City.all_city.vietnam -
Master
dạ ok a, để e fix
-
-
1 <% @cities_international.each do |city| %> 2 <div class="col-3 remove-decoration"> 3 <%= link_to '#' do %> 4 <div class="border border-dark rounded city-name"> 5 <div> 6 <strong><%= city.name %></strong> 7 </div> 8 <div> 9 <%= city.jobs.count %> 10 </div> 1 <div class="col-3 remove-decoration"> -
Đặt tên partial là
_international.html.erblà được vì đang nằm trong thư mụccities -
Master
dạ a
-
-
-
-
added 2 commits
Toggle commit list -
2 2 has_many :city_jobs 3 3 has_many :jobs, through: :city_jobs 4 4 5 def self.top_city 6 joins(:jobs).group(:city_id).order('count(job_id) DESC').limit(9) 7 end 8 def self.all_city 9 joins(:jobs).group(:city_id).order('count(job_id) DESC') 10 end 5 scope :top_city, -> { joins(:jobs).group(:city_id).order('count(job_id) DESC').limit(9) } 6 scope :vietnam, -> { joins(:jobs).group(:city_id).order('count(job_id) DESC').where('location = 1') } 7 scope :international, -> { joins(:jobs).group(:city_id).order('count(job_id) DESC').where('location = 0') } -
Master
dạ a, v. để e fix cái scope VN lun
-
-
-
-
2 <div class="col-4"> 3 <div class="row-table border border-dark rounded industry-list"> 4 <%= link_to '#' do %> 5 <div class="industry-name"><strong><%= industry.name %></strong></div> 6 <div class="count-job"><%= industry.jobs.count %></div> 7 <% end %> 8 </div> 1 <div class="col-4"> 2 <div class="row-table border border-dark rounded industry-list"> 3 <%= link_to '#' do %> 4 <div class="industry-name"><strong><%= industry.name %></strong></div> 5 <div class="count-job"><%= industry.jobs.count %></div> 6 <% end %> 9 7 </div> 10 <% end %> 8 </div> -
Edited by Hoang Phuc Do
Partial này chỉ hiển thị thông tin chi tiết cho 1 industry nên đặt tên file là số ít:
Ví dụ:
_show_industry.html.erbKiểm tra lại tên cho các mục tương tự như city, job
-
-
-
78 78 info = Nokogiri::HTML(URI.open("https://careerbuilder.vn/viec-lam/tat-ca-viec-lam-trang-#{n}-vi.html")) 79 79 links = info.css('div.caption a.company-name').map { |link| link['href'] } 80 80 links.each do |link| 81 next if link == 'javascript:void(0);' 82 page = Nokogiri::HTML(URI.open(URI.escape(link))) 83 name = page.search('p.name')&.text 84 next if name.blank? 85 86 address = page.css('div.content p').children[1]&.text 87 introduction = page.css('div.main-about-us').text 88 81 begin 82 next if link == 'javascript:void(0);' 83 page = Nokogiri::HTML(URI.open(URI.escape(link))) -
Sửa lại indent
-
-
-
-
-
-
added 5 commits
-
a8e034a4...784ae619 - 4 commits from branch
master - 5ca97b87 - Merge branch 'master' into 'industry_list'
Toggle commit list -
a8e034a4...784ae619 - 4 commits from branch
-
43 43 def city_relationship(row, job) 44 44 location_relationship = row.css('div.map p a').children.map { |name_city| name_city.text.strip } 45 45 cities_relationship = City.where(name: location_relationship) 46 city_job_relationship = CityJob.where(job_id: job.id ,city_id: cities_relationship.ids) 46 47 47 job.cities << cities_relationship 48 if city_job_relationship.blank? 49 job.cities << cities_relationship -
Master
job.cities << cities_relationship if city_job_relationship.blank? -
-
-
46 city_job_relationship = CityJob.where(job_id: job.id ,city_id: cities_relationship.ids) 46 47 47 job.cities << cities_relationship 48 if city_job_relationship.blank? 49 job.cities << cities_relationship 50 end 48 51 end 49 52 50 53 def industry_relationship(row, job) 51 54 industry_relationship = row.css('li a').children.map { |name_industry| name_industry.text.strip } 52 55 industries_relationship = Industry.where(name: industry_relationship) 56 industry_job_relationship = IndustryJob.where(job_id: job.id, industry_id: industries_relationship.ids) 53 57 54 job.industries << industries_relationship 58 if industry_job_relationship.blank? 59 job.industries << industries_relationship -
Master
dạ ok để e sửa lại
-
-
1 1 class CitiesController < ApplicationController 2 VIETNAM = 1 3 FOREIGN = 0 2 4 def index 3 @cities_vietnam = City.all_city.vietnam 4 @cities_international = City.all_city.international 5 @cities_vietnam = City.location(VIETNAM) 6 @cities_international = City.location(FOREIGN) -
Master
dạ a
-
-
-
-
-
Toggle commit list
-
merged
Toggle commit list