open-craft/edx-platform — pull request #2 by bradenmacdonald (2014-10-15 03:29:01+00:00)
Title: (WIP) Randomized selection from content libraries - Do not merge, for internal review

This is a continuation of the prototype found in #1, extended to implement [SOL-18](https://openedx.atlassian.net/browse/SOL-18) "As a content author, I am able to select a number of random content blocks that would be displayed in a LibraryContent block."

Testing instructions:

1. Check out this branch on a vanilla devstack (not solutions), and do `paver install_python_prereqs` and `paver update_db`
2. As 'edxapp' user, edit `~/cms.env.json` and add `"ENABLE_CONTENT_LIBRARIES": true` to the `FEATURES` object.
3. Edit `~/cms.auth.json`. Go to `MODULESTORE` > `default` > `OPTIONS` > `stores` - it should contain two or three entries. Re-order the entries so that the store with `"NAME": "split",` comes first in the `stores` list. (This makes [split](https://github.com/edx/edx-platform/wiki/Split:-the-versioning,-structure-saving-DAO) the default modulestore for any new courses.)
4. Start `paver devstack studio` and go to `localhost:8001` in your browser.
5. Log in as staff, and create a new course.
6. Edit the new course in studio. Go to Content > Content Library. Add some content to the library. (Graded problems not tested at this point - stick to content like HTML blocks rather than problems).
7. Go to Settings > Advanced Settings and add `"library_content"` to advanced_modules.
8. Go to Content > Outline. Create a new section and subsection, then edit it. Click "Advanced" and add a new "library_content" block.
9. Once the block is added, click "Edit" to edit its settings. Most are explained on the settings editor. For the "Library" setting, you must click "Add", then paste the CourseLocator of your library. This looks like `course-v1:ProblemX+PR0B+2014+branch@library`. (It's in the URL when you go to Content > Content Library, though the URL may not show the `+branch@library` part, so make sure to add that). Hit Save.
10. Click "Update now with latest components from the library". NOTE: There is a bug right now - the block does not refresh, even if the update succeeds. Until that is fixed, you must manually refresh at this point to see the effect.
11. Optional: Click "View >" to preview all the blocks found in the library.
12. Hit "Publish", then start up the LMS and go to `localhost:8000`. Browse into the course, and you should see that the block is replaced by random blocks from the library. To test the randomization, click the lowest "STAFF DEBUG INFO" link underneath the module, then click "Delete Student State", then refresh the page.