This PR (supersedes PR #18675 which got merged and got reverted due to issues) contains changes to the Randomized Content Block XBlock. The XBlock has unpredictable randomization of the order of the selected child blocks due to the usage of sets, which are unordered, for storing the selected blocks. This becomes apparent when all the available child blocks in a library are chosen for a Randomized Content Block to randomize just the order of the child blocks.
This PR modifies the XBlock to store the selected child blocks in a list after randomly shuffling them.
To guard against the exceptions seen after PR #18675 was merged, this PR also adds defensive checks for such error conditions and redoes the selection if the selected children blocks stored in the `StudentModule` no longer match the current children of the current library_content block. It also logs a message when this happens.
*JIRA tickets*: TBD - ticket will be created on creating this PR.
*Sandbox URL*: TBD
*Merge deadline*: None
1. Login to the CMS as a user who can create and edit courses.
1. Create a library with a few child components.
1. Add a unit to a course.
1. Add a Randomized Content Block to the unit.
1. Select the library created above as the source for this XBlock.
1. Select all types of children to be shown.
1. Specify the total number of components present in the library as the number of components to display.
1. Save the unit and publish it.
1. Register a few students to this course.
1. Navigate to the unit containing this Randomized Content Block.
1. Verify that the order of the content blocks are randomized for every student.
1. Also verify that the same order of children blocks is returned by the `course_blocks` API for that randomized content block.
[ ] @kaizoku
[ ] edX reviewer[s] TBD (@ormsbee maybe?)