Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
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
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Đường Sỹ Hoàng
VenJob
Commits
85e4f1fd
Commit
85e4f1fd
authored
Dec 19, 2019
by
Đường Sỹ Hoàng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Top industries
parent
38dc6cb2
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
0 deletions
+43
-0
app/assets/stylesheets/custom.scss
+4
-0
app/controllers/top_controller.rb
+1
-0
app/models/industry.rb
+9
-0
app/views/industries/_industry.html.erb
+8
-0
app/views/top/index.html.erb
+14
-0
config/settings.yml
+2
-0
lib/tasks/import_job_csv.rake
+5
-0
No files found.
app/assets/stylesheets/custom.scss
View file @
85e4f1fd
...
@@ -67,3 +67,7 @@ h1, h2, h3, h4, h5, h6 {
...
@@ -67,3 +67,7 @@ h1, h2, h3, h4, h5, h6 {
.form-inline-city
{
.form-inline-city
{
padding
:
5px
;
padding
:
5px
;
}
}
.form-inline-industry
{
padding
:
5px
;
}
app/controllers/top_controller.rb
View file @
85e4f1fd
...
@@ -2,5 +2,6 @@ class TopController < ApplicationController
...
@@ -2,5 +2,6 @@ class TopController < ApplicationController
def
index
def
index
@latest_jobs
=
Job
.
latest_jobs
.
take
(
Settings
.
top
.
job
.
limit
)
@latest_jobs
=
Job
.
latest_jobs
.
take
(
Settings
.
top
.
job
.
limit
)
@top_cities
=
City
.
sort_top_cities
.
take
(
Settings
.
top
.
city
.
limit
)
@top_cities
=
City
.
sort_top_cities
.
take
(
Settings
.
top
.
city
.
limit
)
@top_industries
=
Industry
.
sort_top_industries
.
take
(
Settings
.
top
.
industry
.
limit
)
end
end
end
end
app/models/industry.rb
View file @
85e4f1fd
class
Industry
<
ApplicationRecord
class
Industry
<
ApplicationRecord
has_many
:industry_jobs
has_many
:industry_jobs
has_many
:jobs
,
through: :industry_jobs
def
self
.
sort_top_industries
@cindustries
||=
all
.
sort_by
(
&
:jobs_count
).
reverse
end
def
jobs_count
@jobs_count
||=
jobs
.
count
end
end
end
app/views/industries/_industry.html.erb
0 → 100644
View file @
85e4f1fd
<div
class=
"container"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"col-sm"
>
<%=
industry
.
name
%>
(
<%=
industry
.
jobs
.
count
%>
)
</div>
</div>
</div>
app/views/top/index.html.erb
View file @
85e4f1fd
...
@@ -32,4 +32,18 @@
...
@@ -32,4 +32,18 @@
</div>
</div>
</div>
</div>
</div>
</div>
</br>
<div
class=
"Industry list"
>
<div
class=
"Industry-title-wrapper"
>
<h3>
Top Industries
</h3>
</div>
<div
class=
"Industry-content-wrapper"
>
<div
class=
"row row-cols-3"
>
<%=
render
partial:
"industries/industry"
,
collection:
@top_industries
%>
<form
class=
"form-inline-industry"
>
<button
class=
"btn btn-outline-success"
type=
"button"
>
All industries
</button>
</form>
</div>
</div>
</div>
</div>
</div>
config/settings.yml
View file @
85e4f1fd
...
@@ -6,3 +6,5 @@ top:
...
@@ -6,3 +6,5 @@ top:
limit
:
5
limit
:
5
city
:
city
:
limit
:
9
limit
:
9
industry
:
limit
:
9
lib/tasks/import_job_csv.rake
View file @
85e4f1fd
...
@@ -26,6 +26,11 @@ require "csv"
...
@@ -26,6 +26,11 @@ require "csv"
city
=
City
.
find_or_initialize_by
(
name:
row
[
"company province"
])
city
=
City
.
find_or_initialize_by
(
name:
row
[
"company province"
])
city
.
update
(
city_params
)
city
.
update
(
city_params
)
CityJob
.
find_or_create_by
(
job_id:
job
.
id
,
city_id:
city
.
id
)
CityJob
.
find_or_create_by
(
job_id:
job
.
id
,
city_id:
city
.
id
)
industry_params
=
{
name:
row
[
"category"
]
}
industry
=
Industry
.
find_or_initialize_by
(
name:
row
[
"category"
])
industry
.
update
(
industry_params
)
IndustryJob
.
find_or_create_by
(
job_id:
job
.
id
,
industry_id:
industry
.
id
)
rescue
rescue
import_logger
=
ActiveSupport
::
Logger
.
new
(
"log/import.log"
)
import_logger
=
ActiveSupport
::
Logger
.
new
(
"log/import.log"
)
import_logger
.
error
"Skip
#{
row
}
"
import_logger
.
error
"Skip
#{
row
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment