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
bbcd2aba
Commit
bbcd2aba
authored
Aug 10, 2020
by
Huỳnh Thiên Phước
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
c0fe253d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
lib/src/csv_importer.rb
+3
-6
lib/src/job_parser.rb
+1
-0
No files found.
lib/src/csv_importer.rb
View file @
bbcd2aba
...
...
@@ -6,6 +6,7 @@ class CSVImporter
NAME_DOMAIN
=
'192.168.1.156'
.
freeze
FTP_USERNAME
=
'training'
.
freeze
FTP_PASSWORD
=
'training'
.
freeze
def
initialize
(
logger
)
@logger
=
logger
@extracting_directory
=
Rails
.
root
.
join
(
'lib'
,
'csv'
)
...
...
@@ -64,18 +65,14 @@ class CSVImporter
industries_relationship
=
Industry
.
where
(
name:
industry_name
)
industry_job_relationship
=
IndustryJob
.
where
(
job_id:
job
.
id
,
industry_id:
industries_relationship
.
ids
)
if
industry_job_relationship
.
blank?
job
.
industries
<<
industries_relationship
end
job
.
industries
<<
industries_relationship
if
industry_job_relationship
.
blank?
location_data
=
row
[
"work place"
]
location
=
location_data
.
gsub
(
'["'
,
''
).
gsub
(
'"]'
,
''
)
location_relationship
=
City
.
where
(
name:
location
)
location_job_relationship
=
CityJob
.
where
(
job_id:
job
.
id
,
city_id:
location_relationship
.
ids
)
if
location_job_relationship
.
blank?
job
.
cities
<<
location_relationship
end
job
.
cities
<<
location_relationship
if
location_job_relationship
.
blank?
rescue
StandardError
=>
e
@logger
.
error
e
.
message
...
...
lib/src/job_parser.rb
View file @
bbcd2aba
...
...
@@ -15,6 +15,7 @@ class JobParser
links
=
info
.
css
(
'div.caption a.company-name'
).
map
{
|
link
|
link
[
'href'
]
}
links
.
each
do
|
link
|
next
if
link
==
'javascript:void(0);'
page
=
Nokogiri
::
HTML
(
URI
.
open
(
URI
.
escape
(
link
)))
name
=
page
.
search
(
'p.name'
)
&
.
text
next
if
name
.
blank?
...
...
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