Skip to content

Commit

Permalink
feat: handle empty national ids
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon committed Oct 9, 2024
1 parent 6d169c5 commit 49e647c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion eox_nelp/signals/receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def mt_course_passed_handler(user, course_id, **kwargs): # pylint: disable=unus
return

extra_info = getattr(user, "extrainfo", None)
national_id = extra_info.national_id if extra_info else user.username
national_id = extra_info.national_id if extra_info and extra_info.national_id else user.username

update_mt_training_stage.delay(
course_id=str(course_id),
Expand Down
2 changes: 1 addition & 1 deletion eox_nelp/signals/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def course_completion_mt_updater(user_id, course_id, stage_result, force_graded=
"""
user = User.objects.get(id=user_id)
extra_info = getattr(user, "extrainfo", None)
national_id = extra_info.national_id if extra_info else user.username
national_id = extra_info.national_id if extra_info and extra_info.national_id else user.username
is_complete, graded = get_completed_and_graded(user_id, course_id)

if not is_complete or (force_graded and not graded) or (not force_graded and graded):
Expand Down

0 comments on commit 49e647c

Please sign in to comment.