From 59a69007e2503e1075d8824cacd22f621b9a2178 Mon Sep 17 00:00:00 2001 From: andrey-canon Date: Tue, 6 Aug 2024 13:46:34 -0500 Subject: [PATCH] chore: change condition logic --- eox_nelp/signals/receivers.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/eox_nelp/signals/receivers.py b/eox_nelp/signals/receivers.py index 2695a7d2..167c9185 100644 --- a/eox_nelp/signals/receivers.py +++ b/eox_nelp/signals/receivers.py @@ -395,23 +395,25 @@ def pearson_vue_course_completion_handler(instance, **kwargs): # pylint: disabl is_complete, graded = get_completed_and_graded(user_id=instance.user_id, course_id=str(instance.context_key)) - if is_complete and not graded: - LOGGER.info( - "Initializing rti task for the user %s, action triggered by course completion status", - instance.user_id, - ) + if graded or not is_complete: + return - if getattr(settings, "USE_PEARSON_ENGINE_SERVICE", False): - real_time_import_task_v2.delay( - user_id=instance.user_id, - exam_id=str(instance.context_key), - action_name="rti", - ) - else: - real_time_import_task.delay( - user_id=instance.user_id, - course_id=str(instance.context_key), - ) + LOGGER.info( + "Initializing rti task for the user %s, action triggered by course completion status", + instance.user_id, + ) + + if getattr(settings, "USE_PEARSON_ENGINE_SERVICE", False): + real_time_import_task_v2.delay( + user_id=instance.user_id, + exam_id=str(instance.context_key), + action_name="rti", + ) + else: + real_time_import_task.delay( + user_id=instance.user_id, + course_id=str(instance.context_key), + ) def pearson_vue_course_passed_handler(user, course_id, **kwargs): # pylint: disable=unused-argument