-
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
fix: not start rti tasks if not course-config #216
Conversation
Check the existence of course-config for the processed course_id. If there is not course-config (`PEARSON_RTI_COURSES_DATA`) for the desired course, RTI requests would not be sent. Refactored a little the tests.
1441af0
to
7785b9b
Compare
eox_nelp/signals/receivers.py
Outdated
|
||
Arguments: | ||
instance<Blockcompletion>: Instance of BlockCompletion model. | ||
""" | ||
if not getattr(settings, "PEARSON_RTI_ACTIVATE_COMPLETION_GATE", False): | ||
if not getattr(settings, "PEARSON_RTI_ACTIVATE_COMPLETION_GATE", False) or not getattr( | ||
settings, "PEARSON_RTI_COURSES_DATA", {} |
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.
please consider to update the setting name and type
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.
The question is: is someone using the past integration? The idea was to keep compatibility with both integrations.
Anyway why fo you say the type? to change the dict to a list or something like that? I also like the dict approach:
{
"PEARSON_RTI_COURSES_DATA": {
"course-v1:one": true,
"course-v1:two": true,
"course-v1:three": false
...
}
}
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.
The question is: is someone using the past integration? The idea was to keep compatibility with both integrations.
If the setting name has been changed, it doesn’t mean the previous implementation is unavailable. It might require an extra configuration step, which could seem redundant, but it remains compatible.
Anyway why fo you say the type? to change the dict to a list or something like that? I also like the dict approach:
You mentioned compatibility, but the dictionary approach is indeed completely new; the current implementation does not support that structure. However, if you prefer the dictionary over a simple list, that’s fine. Just update the setting name and adjust the logic to check for the value instead of the 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.
Actually the v0 version is also compatible looking the test:
eox-nelp/eox_nelp/signals/tests/test_receivers.py
Lines 703 to 710 in 7785b9b
course_exam_configuration = { | |
course_id: { | |
"exam_authorization_count": 3, | |
"exam_series_code": "OTT" | |
}, | |
} | |
@override_settings(PEARSON_RTI_COURSES_DATA=course_exam_configuration) |
Is like
{
"PEARSON_RTI_COURSES_DATA": {
"course-v1:one": {
"exam_authorization_count": 3,
"exam_series_code": "OTT"
},
"course-v1:two": {
"exam_authorization_count": 23,
"exam_series_code": "OTT"
},
"course-v1:three": {
"exam_authorization_count": 13,
"exam_series_code": "OTT"
}
...
}
so each course if the value is python truthy like a defined dict: it would pass.
So what's the purpose of creating another setting for courses, if the current could work in both versions
So in both examples I am checking the value of the key:
with the dict get
eox-nelp/eox_nelp/signals/receivers.py
Lines 395 to 397 in 7785b9b
if not getattr(settings, "PEARSON_RTI_ACTIVATE_COMPLETION_GATE", False) or not getattr( | |
settings, "PEARSON_RTI_COURSES_DATA", {} | |
).get(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.
So what's the purpose of creating another setting for courses, if the current could work in both versions
basically the name of the settings doesn't reflect the purpose of the setting
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.
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.
- You don't have to manage two settings previous implementation is deprecated and you shouldn't use it
- You didn't have to add the second condition that implementation fails if that setting is not present
- The previous implementation is deprecated therefore you shouldn't modify that at all
- You don't need any query, it's faster if you do that manually there are only two courses
e822d4c
to
f72c455
Compare
763343d
to
e1af959
Compare
This settings must to be a list with the course_id strings enabled
e1af959
to
f125f1e
Compare
@andrey-canon COuld you check if you agree with f125f1e. The setting now would have this shape. And I have to update manually the 2 courses or tenant_config using the PVengine integration. "PEARSON_ENGINE_COURSES_ENABLED" : ["course-v1:one", "course-v1:two"] PD: Tests are falling due granular fine token permission to clone custom_reg_form. |
Description
Check the existence of course-config for the processed course_id.
If there is not course-config (
PEARSON_RTI_COURSES_DATA
) for the desired course,RTI requests would not be sent.
Refactored a little the tests.
Testing instructions
Before
After
Additional information
Jira story:
Checklist for Merge