Skip to content

Commit

Permalink
deal with apply_url
Browse files Browse the repository at this point in the history
  • Loading branch information
honzajavorek committed Sep 23, 2021
1 parent 5d032ac commit 5f2fe9b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion juniorguru/sync/employments/spiders/backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@

def employment_adapter(ci_data):
for row in (yield 'SELECT * from employment'):
apply_url = ((row['apply_link'] if 'apply_link' in row else None) or
(row['external_link'] if 'external_link' in row else None) or
(row['link'] if '&utm_' in row['link'] else None))
for seen_at in (date.fromisoformat(row['first_seen_at']), date.fromisoformat(row['last_seen_at'])):
yield Employment(title=row['title'],
url=strip_utm_params(row['url']),
apply_url=apply_url,
company_name=row['company_name'],
locations=row['locations'] if 'locations' in row else [],
description_html=row['description_html'],
Expand All @@ -32,10 +36,13 @@ def employment_adapter(ci_data):

def job_adapter(ci_data): # old-style jobs
for row in (yield 'SELECT * from job'):
# TODO deal with link, apply_link, utm params links
apply_url = ((row['apply_link'] if 'apply_link' in row else None) or
(row['external_link'] if 'external_link' in row else None) or
(row['link'] if '&utm_' in row['link'] else None))
for seen_at in (date.fromisoformat(row['posted_at']), ci_data['build_date']):
yield Employment(title=row['title'],
url=strip_utm_params(row['link']),
apply_url=apply_url,
company_name=row['company_name'],
locations=json.loads(row['locations']),
description_html=row['description_html'],
Expand Down

0 comments on commit 5f2fe9b

Please sign in to comment.