Skip to content

Commit

Permalink
Merge pull request #56 from edx/ashultz0/unflag-celery
Browse files Browse the repository at this point in the history
fix: move toggle check out of task
  • Loading branch information
ashultz0 authored Sep 29, 2021
2 parents faab25d + 264d2d6 commit 26e0d04
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Change Log
Unreleased
~~~~~~~~~~

[1.0.1] - 2021-09-28
~~~~~~~~~~~~~~~~~~~~~
* Move toggle check out of tasks

[1.0.0] - 2021-09-23
~~~~~~~~~~~~~~~~~~~~~
* Move signal receiver logic into celery task
Expand Down
2 changes: 1 addition & 1 deletion edx_name_affirmation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Django app housing name affirmation logic.
"""

__version__ = '1.0.0'
__version__ = '1.0.1'

default_app_config = 'edx_name_affirmation.apps.EdxNameAffirmationConfig' # pylint: disable=invalid-name
25 changes: 14 additions & 11 deletions edx_name_affirmation/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from edx_name_affirmation.signals import VERIFIED_NAME_APPROVED
from edx_name_affirmation.statuses import VerifiedNameStatus
from edx_name_affirmation.tasks import idv_update_verified_name, proctoring_update_verified_name
from edx_name_affirmation.toggles import is_verified_name_enabled

User = get_user_model()

Expand Down Expand Up @@ -42,7 +43,8 @@ def idv_attempt_handler(attempt_id, user_id, status, photo_id_name, full_name, *
photo_id_name(str): name to be used as verified name
full_name(str): user's pending name change or current profile name
"""
idv_update_verified_name.delay(attempt_id, user_id, status, photo_id_name, full_name)
if is_verified_name_enabled():
idv_update_verified_name.delay(attempt_id, user_id, status, photo_id_name, full_name)


def proctoring_attempt_handler(
Expand All @@ -69,13 +71,14 @@ def proctoring_attempt_handler(
is_proctored(boolean): if the exam attempt is for a proctored exam
backend_supports_onboarding(boolean): if the exam attempt is for an exam with a backend that supports onboarding
"""
proctoring_update_verified_name.delay(
attempt_id,
user_id,
status,
full_name,
profile_name,
is_practice_exam,
is_proctored,
backend_supports_onboarding
)
if is_verified_name_enabled():
proctoring_update_verified_name.delay(
attempt_id,
user_id,
status,
full_name,
profile_name,
is_practice_exam,
is_proctored,
backend_supports_onboarding
)
5 changes: 0 additions & 5 deletions edx_name_affirmation/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from edx_name_affirmation.models import VerifiedName
from edx_name_affirmation.statuses import VerifiedNameStatus
from edx_name_affirmation.toggles import is_verified_name_enabled

User = get_user_model()

Expand All @@ -25,8 +24,6 @@ def idv_update_verified_name(attempt_id, user_id, status, photo_id_name, full_na
"""
Celery task for updating a verified name based on an IDV attempt
"""
if not is_verified_name_enabled():
return

trigger_status = VerifiedNameStatus.trigger_state_change_from_idv(status)
verified_names = VerifiedName.objects.filter(user__id=user_id, verified_name=photo_id_name).order_by('-created')
Expand Down Expand Up @@ -102,8 +99,6 @@ def proctoring_update_verified_name(
"""
Celery task for updating a verified name based on a proctoring attempt
"""
if not is_verified_name_enabled():
return

# We only care about updates from onboarding exams, or from non-practice proctored exams with a backend that
# does not support onboarding. This is because those two event types are guaranteed to contain verification events,
Expand Down

0 comments on commit 26e0d04

Please sign in to comment.