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
0
Merge Requests
0
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
Huỳnh Thiên Phước
venjob
Commits
17665622
Commit
17665622
authored
Aug 05, 2020
by
Huỳnh Thiên Phước
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix csv importer at create job
parent
a08b33ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
lib/src/csv_importer.rb
+11
-15
No files found.
lib/src/csv_importer.rb
View file @
17665622
...
...
@@ -53,26 +53,22 @@ class CSVImporter
description_job
=
"
#{
row
[
"description"
]
}
#{
row
[
"requirement"
]
}
"
level
=
row
[
"level"
]
salary
=
row
[
"salary"
]
job
=
Job
.
find_or_create_by!
(
title:
title_job
,
description:
description_job
,
level:
level
,
salary:
salary
,
company_id:
company
.
id
)
next
if
job
.
blank?
industry_name
=
row
[
"category"
]
industries_relationship
=
Industry
.
find_by
(
name:
industry_name
)
next
if
industries_relationship
.
blank?
industry_relationship
=
find_or_create_by!
(
job_id:
job
.
id
,
industry_id:
industries_relationship
.
id
)
industries_relationship
=
Industry
.
where
(
name:
industry_name
)
location_data
=
row
[
"work place"
]
location
=
location_data
.
gsub
(
'["'
,
''
).
gsub
(
'"]'
,
''
)
location_relationship
=
City
.
find_by
(
name:
location
)
next
if
location_relationship
.
blank?
city_relationship
=
find_or_create_by!
(
job_id:
job
.
id
,
industry_id:
location_relationship
.
id
)
location_relationship
=
City
.
where
(
name:
location
)
Job
.
find_or_create_by!
(
title:
title_job
,
description:
description_job
,
level:
level
,
salary:
salary
,
company_id:
company_id
)
do
|
job
|
job
.
industries
<<
industries_relationship
job
.
cities
<<
location_relationship
end
rescue
StandardError
=>
e
@logger
.
error
e
.
message
...
...
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