Skip to content

Commit

Permalink
fix: Do not create a job if all of the releated skills does not exist…
Browse files Browse the repository at this point in the history
… in database
  • Loading branch information
muhammad-ammar committed Mar 29, 2023
1 parent 1b0a0bc commit e999310
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Change Log
Unreleased

[1.36.3] - 2023-03-29
---------------------
* fix: Do not create a job if all of the releated skills does not exist in database

[1.36.2] - 2023-03-08
---------------------
* fix: remove validations on skills in skill quiz
Expand Down
2 changes: 1 addition & 1 deletion taxonomy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
# 2. MINOR version when you add functionality in a backwards compatible manner, and
# 3. PATCH version when you make backwards compatible bug fixes.
# More details can be found at https://semver.org/
__version__ = '1.36.2'
__version__ = '1.36.3'

default_app_config = 'taxonomy.apps.TaxonomyConfig' # pylint: disable=invalid-name
8 changes: 7 additions & 1 deletion taxonomy/management/commands/refresh_job_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ def _update_job_skills(job_bucket, industry=None):
Persist the jobs data in the database.
"""
job_id = job_bucket['name']
job, _ = Job.objects.get_or_create(external_id=job_id)
skill_buckets = job_bucket['ranking']['buckets']
skill_external_ids = [skill_bucket['name'] for skill_bucket in skill_buckets]

# If not a single skill exists then it doesn't make sense to create a job so return
if not Skill.objects.filter(external_id__in=skill_external_ids).exists():
return

job, _ = Job.objects.get_or_create(external_id=job_id)
for skill_bucket in skill_buckets:
skill_id = skill_bucket['name']
try:
Expand Down

0 comments on commit e999310

Please sign in to comment.