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
2
Merge Requests
2
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
Thanh Hung Pham
veNJOB
Commits
d04c9f2f
Commit
d04c9f2f
authored
Jul 03, 2017
by
Thanh Hung Pham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix import categories and cities
parent
e3fd63c3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
lib/tasks/careerbuilder.rb
+4
-4
No files found.
lib/tasks/careerbuilder.rb
View file @
d04c9f2f
...
...
@@ -128,7 +128,7 @@ class Careerbuilder
def
import_category
(
doc
)
categories
=
doc
.
xpath
(
"//div[@class='s-home2']/div[@id='NewSearchJob3']/form/div[@class='search-horizontal']/div[@class='ui-widget box_multiSelect_industry']/select/option"
)
categories
=
categories
.
slice
(
1
..
categories
.
size
-
2
)
categories
=
categories
.
drop
(
1
)
categories
.
each
do
|
category
|
Category
.
new
(
name:
category
.
text
.
strip
).
save
if
Category
.
where
(
name:
category
.
text
.
strip
).
blank?
end
...
...
@@ -140,10 +140,10 @@ class Careerbuilder
def
import_city
(
doc
)
cities
=
doc
.
xpath
(
"//div[@class='s-home2']//div[@id='NewSearchJob3']/form/div[@class='search-horizontal']/div[@class='ui-widget box_multiSelect_location']/select/option"
).
drop
(
1
)
area
_id
=
1
area
=
Area
.
find_by_name
(
'Viet Nam'
)
cities
.
each
do
|
city
|
area
_id
=
2
if
city
.
text
==
'Angola'
City
.
new
(
name:
city
.
text
.
strip
,
area:
Area
.
find
(
area_id
)
).
save
if
City
.
where
(
name:
city
.
text
.
strip
).
blank?
area
=
Area
.
find_by_name
(
'International'
)
if
city
.
text
==
'Angola'
City
.
new
(
name:
city
.
text
.
strip
,
area:
area
).
save
if
City
.
where
(
name:
city
.
text
.
strip
).
blank?
end
rescue
StandardError
=>
e
logger
.
error
(
"[method: ]
#{
import_city
}
"
)
...
...
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