edx-solutions/edx-platform — pull request #241 by aboudreault (2014-09-26 14:35:33+00:00)
Title: revert-multiple-cohorts: Add checks in code and a management command to ease the revert

This PR adds some code checks and a management command to ensure things are ok. Basically, the management script will:

Check & Fix all CourseUserGroups that have an invalid group_type (workgroup)
Check & Fix that users or in at least 1 cohort for a course.
Check that users are not in multiple cohorts for a course. (This have be fixed manually using the LMS dashboard)
To use the management command, run:

./manage.py lms revert_workgroup
You should see a output of the current issues and some instruction to fix them. Then, run the management command with the --fix option and apply the manual fixes if there are.

note that this PR has to be merged too for a good use of the script: https://github.com/edx-solutions/edx-platform/pull/239