edx-platform
edx-platform copied to clipboard
One student module history per request
NOTE: THIS SOLUTION IS DEPENDENT ON #31189
Description
When a student submits a problem answer, the state is stored in a StudentModule record containing answer, score, correctness, etc. The record, though, is updated in multiple steps within the single request (first the grade is updated, then the state is updated separately). Each partial save would trigger a separate StudentModuleHistory record to be stored resulting in duplicate and inaccurate historical records.
This solution uses the RequestCache to track within a request thread which StudentModules are updated and a single corresponding StudentModuleHistory id. If multiple update actions occur within the request cycle, then modify the history record that was already generated to ensure that each submission only results in one StudentModuleHistory record.
Supporting information
This issue and its solution were discussed here
Testing instructions
Submit an answer for any problem xblock, then confirm that the courseware_studentmodulehistory
table only contains one new row corresponding to the latest submission.
Deadline
None
Other information
None
Thanks for the pull request, @jcohen28! Please note that it may take us up to several weeks or months to complete a review and merge your PR.
Feel free to add as much of the following information to the ticket as you can:
- supporting documentation
- Open edX discussion forum threads
- timeline information ("this must be merged by XX date", and why that is)
- partner information ("this is a course on edx.org")
- any other information that can help Product understand the context for the PR
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.
Please let us know once your PR is ready for our review and all tests are green.
📣 💥 Heads-up: You must either rebase onto master or merge master into your branch to keep passing required checks.
We added a new required check, "Tests Successful," that this PR does not yet run. Rebasing will get it started.
If you have any questions, please reach out to the Architecture team (either #architecture on Open edX Slack or #external-architecture on edX internal Slack).
@jcohen28 Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future.