Repository navigation
feat: handle exam submission and reset - #33323
Conversation
|
Yep never mind that, we're merging to master now. |
Note this message may be dated depending on whether or not the openedx-events is unpinned on master via this PR: #33392 |
3227985 to
e033037
Compare
e033037 to
25794ac
Compare
| 'Error occurred while attempting to reset module state for user_id ' | ||
| f'{student.id} for content_id {content_id}.' | ||
| ) | ||
| log.error(err_msg) |
There was a problem hiding this comment.
NIT: small inconsistency in how log.error() is called w/ or w/o a err_msg variable defined.
| course_key = event_data.course_key | ||
| content_id = str(usage_key) | ||
|
|
||
| try: |
There was a problem hiding this comment.
I just noticed that this code is mostly a copy/paste of the delete_student_attempt() code in services.py. Should we do something similar to what we did in the invalidate certificate consumer PR, where we compartmentalize this code in an api function (or something similar)?
There was a problem hiding this comment.
Side note that if you chose to do this, you may have to (slightly) modify your handlers and services tests, and may also need to add a test to test_api.py for coverage.
There was a problem hiding this comment.
The code here is similar but I'd argue a helper function adds complexity since the purpose of these two functions is to interface with a different system with slightly different inputs.
Thinking a bit forward to the fact that services.py eventually goes away. Better to duplicate and easily delete half than need to refactor shared code later.
I think there's something to be said about where the call to reset_student_attempts is. It could probably be refactored into the update_completion_task but I stopped short of that to avoid reworking too many things.
There was a problem hiding this comment.
I see, in that case, should I refactor my code in the invalidate certificate PR to not have a helper function for the same reason? We decided that this is dependent on whether or not the helper function would call something in another service.
f8bb2d9 to
c67bd20
Compare
This reverts commit 9f16b0f.
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
MST-2112
Handles events from edx-exams that impact learner completion
Design note. I stayed away from calling anything within the InstructorService class for this event handler. I'd recommend this approach for other consumers as well since the purpose of that class is to be injected into edx-proctoring at runtime. It might cause small amounts of duplicate logic but it allows us to keep the integration with edx-proctoring and edx-exams clearly separated. I'd expect InstructorService to go away if/when edx-proctoring is no longer in use. This is a similar pattern to what we did on the exam publishing side of things.
Refactors some tests out of InstructorService. Most of these tests were testing behavior in tasks.py anyway and it's now called from more than one location. I added a test file to handle that behavior specifically.