Commit 91e3d553 by Hoang Nam Nguyen

'Fixed'

parent 785ef9b6
......@@ -12,7 +12,6 @@ gem 'zip-zip' # will load compatibility for old rubyzip API.
gem 'nokogiri'
gem 'whenever', :require => false
gem "figaro"
gem 'counter_culture', '~> 0.1.33'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.3'
# Use mysql as the database for Active Record
......
......@@ -40,9 +40,6 @@ GEM
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
after_commit_action (1.0.1)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
arel (8.0.0)
bindex (0.5.0)
bootstrap-will_paginate (1.0.0)
......@@ -68,12 +65,10 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
counter_culture (0.1.34)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
after_commit_action (~> 1.0.0)
erubi (1.6.1)
execjs (2.7.0)
faraday (0.13.1)
multipart-post (>= 1.2, < 3)
ffi (1.9.18)
figaro (1.1.1)
thor (~> 0.14)
......@@ -99,6 +94,7 @@ GEM
mini_portile2 (2.2.0)
minitest (5.10.3)
multi_json (1.12.1)
multipart-post (2.0.0)
mysql2 (0.4.9)
nio4r (2.1.0)
nokogiri (1.8.0)
......@@ -142,6 +138,9 @@ GEM
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rsolr (2.0.2)
builder (>= 2.1.2)
faraday
ruby_dep (1.5.0)
rubyzip (1.2.1)
sass (3.5.1)
......@@ -205,7 +204,6 @@ DEPENDENCIES
byebug
capybara (~> 2.13)
coffee-rails (~> 4.2)
counter_culture (~> 0.1.33)
figaro
jbuilder (~> 2.5)
listen (>= 3.0.5, < 3.2)
......@@ -215,6 +213,7 @@ DEPENDENCIES
pry-byebug
puma (~> 3.7)
rails (~> 5.1.3)
rsolr
rubyzip (>= 1.0.0)
sass-rails (~> 5.0)
selenium-webdriver
......
This source diff could not be displayed because it is too large. You can view the blob instead.
class TopPagesController < ApplicationController
def cities
@vn_cities = City.where.not(is_vietnam: :acchived )
@international_cities = City.where(is_vietnam: :active)
@vn_cities = City.vietnam
@international_cities = City.international
end
def industries
......@@ -12,7 +12,7 @@ class TopPagesController < ApplicationController
end
def top_page
@jobs = Job.recent.limit(ENV["Number_top_page_jobs"])
@jobs = Job.recent(ENV["Number_top_page_jobs"])
@total_job = Job.count
@industries = Industry.limit(ENV["Number_top_page"])
@cities = City.limit(ENV["Number_top_page"])
......
class City < ApplicationRecord
has_many :job_cities
has_many :jobs, through: :job_cities
enum city_type: {vietnam: 1, international: 0}
end
......@@ -4,5 +4,5 @@ class Job < ApplicationRecord
has_many :job_industries
has_many :industries, through: :job_industries
scope :recent, -> { order(id: :desc) }
scope :recent, -> (num) { order(id: :desc).limit(num) }
end
<% if city.job_cities_count != 0 %>
<% if city.job_cities_count > 0 %>
<div class="col-md-4 list-group-item">
<ul>
<li>
......
<% if industry.job_industries_count !=0 %>
<% if industry.job_industries_count > 0 %>
<div class="col-md-4 list-group-item">
<ul>
<li>
......
......@@ -3,11 +3,12 @@
<%= job.job_title %>
</p>
</a>
<div class="content_job">
<li class="detail_description"> <%= truncate job.short_description,length: 160%>
<%= link_to 'read more', '#' %> </li>
<li class="detail_description"> <%= job.salary %> </li>
<li class="detail_description"><%= truncate job.short_description,length: 160%>
<%= link_to 'read more', '#' %></li>
<li class="detail_description"> <%= job.salary %></li>
<% job.cities.each do |city| %>
<li class="detail_description"> <%= city.location %> </li>
<% end %>
<li class="detail_description"><%= city.location %></li>
<% end %>
</div>
\ No newline at end of file
class AddBooleanToCities < ActiveRecord::Migration[5.1]
def change
add_column :cities, :is_vietnam, :boolean
enum is_vietnam: {active: 0, acchived: 1}
add_column :cities, :city_type, :integer
end
end
class Solr
def initialize
@solr = RSolr.connect :url => 'http://localhost:8983/solr/venjobs'
end
def self.sync_all
import_fields = [salary,industry,city,company]
end
end
\ No newline at end of file
......@@ -16,7 +16,7 @@ namespace :crawl do
cities.each do |city|
next if city.text == 'Tất cả địa điểm'
is_vietnam = false if city.text == 'Angola'
City.find_or_create_by!(location: city.text, is_vietnam: is_vietnam)
City.find_or_create_by!(location: city.text, city_type: is_vietnam)
end
#get industry and save database
......
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