-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: extract completion logic from pipe to implement it into rec… #213
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a logic suggestion. I think test would pass with that change.
eox_nelp/signals/receivers.py
Outdated
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 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), | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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), | |
) | |
if (not is_complete) or graded: | |
return | |
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), | |
) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very similar to my first approach if graded or not is_complete:
but I decided to leave as similar as possible in order to make easier the review, anyway I will update that
eb1d459
to
59a6900
Compare
Description
This move the completion logic from the pipeline step to the receiver, this also adds some logs to monitor which actions is triggered the pearson task
Testing instructions
Before
After
Additional information
Include anything else that will help reviewers and consumers understand the change.
Checklist for Merge