MIT: CCX. Implement auto-enroll for CCX students

Based loosely on course enrollment model

Ensure that registered users are 'active' when they are enrolled in a POC

Respect the 'auto enroll' and 'email students' checkboxes in the UI

Add an auto_enroll flag to the PocFutureMembership model so we can automatically enroll non-users when they have registered and activated their account.

Build a future enrollment using the auto_enroll value from the request so we can ensure that non-existent users can be auto-enrolled

Ensure that any user added by way of the one-at-a-time UI is automatically auto-enrolled

Update tests with email sending to use the flag from the request

Provide api on the PocMembership object to auto-enroll a newly active member in this poc.

This method will delete the passed PocFutureMembership object and will automatically enroll the user in the POC named in that future membership as well as the MOOC from which it was created

Conditionally activate poc memberships that are pending when a new registree first activates their account.
This commit is contained in:
cewing
2014-12-30 14:25:06 -08:00
parent 2b4da4d836
commit d4a1e99a83
6 changed files with 142 additions and 5 deletions

View File

@@ -1806,6 +1806,16 @@ def activate_account(request, key):
if cea.auto_enroll:
CourseEnrollment.enroll(student[0], cea.course_id)
# enroll student in any pending POCs he/she may have if auto_enroll flag is set
if settings.FEATURES.get('PERSONAL_ONLINE_COURSES'):
from pocs.models import PocMembership, PocFutureMembership
pfms = PocFutureMembership.objects.filter(
email=student[0].email
)
for pfm in pfms:
if pfm.auto_enroll:
PocMembership.auto_enroll(student[0], pfm)
resp = render_to_response(
"registration/activation_complete.html",
{