Commit 99841a3b by Ngo Trung Hung

create -top industry

parent e1d92db5
...@@ -6,5 +6,6 @@ class HomeController < ApplicationController ...@@ -6,5 +6,6 @@ class HomeController < ApplicationController
@five_jobs = Job.order(created_at: :asc).where(newdata: 1).limit(5) @five_jobs = Job.order(created_at: :asc).where(newdata: 1).limit(5)
@cities = City.all @cities = City.all
@top_city = City.top_hot.take(11) @top_city = City.top_hot.take(11)
@top_industry = Industry.top_hot.take(11)
end end
end end
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
</div> </div>
<%= render 'shared/box_five_job' %> <%= render 'shared/box_five_job' %>
<%= render 'shared/box_nine_city' %> <%= render 'shared/box_nine_city' %>
<%= render 'shared/box_nine_industries' %>
<div class="box_info_city"> <div class="box_info_city">
<div class="ct_name"> <div class="ct_name">
<%= link_to name_city, '#' ,class: 'link_ct'%> <%= link_to name_city, '#' ,class: 'link_ct'%>
</div> </div>
<div class="ct_jobs_count"> <div class="ct_jobs_count">
<%= link_to "#{jobs_count} công việc", '#' ,class: 'link_ct'%> <%= link_to "#{jobs_count} công việc", '#' ,class: 'link_ct'%>
</div> </div>
</div> </div>
\ No newline at end of file
<div class="box_info_city">
<div class="ct_name">
<%= link_to industry, '#' ,class: 'link_ct'%>
</div>
<div class="ct_jobs_count">
<%= link_to "#{jobs_count} công việc", '#' ,class: 'link_ct'%>
</div>
</div>
\ No newline at end of file
<div class="container">
<div class="border_box_cities">
<div class="box_text_five_jobs box_padding_city">
<span>Top các nghành phổ biến</span>
</div>
<div class="row no-gutters">
<% @top_industry.each do |k,v| %>
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
<%= render 'shared/block_industries_hot',industry: k, jobs_count: v %>
</div>
<% end %>
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
<%= render 'shared/load_more_city' %>
</div>
</div>
</div>
</div>
\ No newline at end of file
...@@ -14,7 +14,7 @@ default: &default ...@@ -14,7 +14,7 @@ default: &default
encoding: utf8 encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root username: root
password: '1' password: '12345678'
socket: /var/run/mysqld/mysqld.sock socket: /var/run/mysqld/mysqld.sock
......
...@@ -21,7 +21,7 @@ class FtpSever ...@@ -21,7 +21,7 @@ class FtpSever
end end
def self.data_csv def self.data_csv
donwload_csv() # donwload_csv()
table = CSV.parse(File.read("lib/csv/jobs.csv"), headers: true) table = CSV.parse(File.read("lib/csv/jobs.csv"), headers: true)
end end
...@@ -73,7 +73,6 @@ class FtpSever ...@@ -73,7 +73,6 @@ class FtpSever
puts 'Done import data companies' puts 'Done import data companies'
end end
def self.parse_csv_jobs(data) def self.parse_csv_jobs(data)
Job.update_all(newdata: 0) Job.update_all(newdata: 0)
data['name'].each_with_index do |name, index| data['name'].each_with_index do |name, index|
......
...@@ -108,14 +108,7 @@ class InterfaceWeb ...@@ -108,14 +108,7 @@ class InterfaceWeb
@industry_name << industries.join(',') @industry_name << industries.join(',')
@description << page.search(".tabs .tab-content .detail-row:nth-child(n)").to_s.delete!("[\n,\t,\r]") @description << page.search(".tabs .tab-content .detail-row:nth-child(n)").to_s.delete!("[\n,\t,\r]")
block_industries_hotlstrip.split('Cấp bậc')
get_level = page.search(".item-blue .detail-box:last ul li:nth-child(3)").text.delete!("[\n,\t,\r]").lstrip.split('Cấp bậc')
get_level = get_level[1].to_s.strip
if get_level == ""
g_level = page.search(".item-blue .detail-box:last ul li:nth-child(2)").text.delete!("[\n,\t,\r]").lstrip.split('Cấp bậc')
@level << g_level[1].to_s.strip
else
g_level = page.search(".item-blue .detail-box:last ul li:nth-child(3)").text.delete!("[\n,\t,\r]").lstrip.split('Cấp bậc')
@level << g_level[1].to_s.strip @level << g_level[1].to_s.strip
end end
......
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