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
d4fbe2af
Commit
d4fbe2af
authored
Aug 10, 2020
by
Huỳnh Thiên Phước
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change logic job_parser
parent
8aac2ef3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
lib/src/job_parser.rb
+5
-2
No files found.
lib/src/job_parser.rb
View file @
d4fbe2af
...
...
@@ -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?
...
...
@@ -34,15 +35,17 @@ class JobParser
def
city_relationship
(
row
,
job
)
location_relationship
=
row
.
css
(
'div.map p a'
).
children
.
map
{
|
name_city
|
name_city
.
text
.
strip
}
cities_relationship
=
City
.
where
(
name:
location_relationship
)
city_job_relationship
=
CityJob
.
where
(
job_id:
job
.
id
,
city_id:
cities_relationship
.
ids
)
job
.
cities
<<
cities_relationship
job
.
cities
<<
cities_relationship
if
city_job_relationship
.
blank?
end
def
industry_relationship
(
row
,
job
)
industry_relationship
=
row
.
css
(
'li a'
).
children
.
map
{
|
name_industry
|
name_industry
.
text
.
strip
}
industries_relationship
=
Industry
.
where
(
name:
industry_relationship
)
industry_job_relationship
=
IndustryJob
.
where
(
job_id:
job
.
id
,
industry_id:
industries_relationship
.
ids
)
job
.
industries
<<
industries_relationship
job
.
industries
<<
industries_relationship
if
industry_job_relationship
.
blank?
end
def
create_job
(
title
,
link_page
,
row
,
company
)
...
...
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