Use the standard enrollment table instead of a custom CCX table for CCX

enrollments.

The goal for this PR is to have a single mechanism for registering users and
reducing the number of places where special-casing for ccx courses is needed. The
migration at this point is purposefully limited to convert ccx memberships into
student enrollments when moving forward. No backward migration is in place at the
moment. The ccx membership tables are not removed at this time. It is possible to go
backwards and forwards multiple times with no errors or data loss.
This commit is contained in:
Carlos de la Guardia
2015-07-13 06:16:15 -05:00
parent 6530d5e3ec
commit 458ed0a64e
15 changed files with 210 additions and 1174 deletions

View File

@@ -15,6 +15,8 @@ from xmodule.error_module import ErrorDescriptor
from xmodule.modulestore.django import modulestore
from xmodule_django.models import CourseKeyField, UsageKeyField
from ccx_keys.locator import CCXLocator
class CourseOverview(TimeStampedModel):
"""
@@ -100,17 +102,26 @@ class CourseOverview(TimeStampedModel):
except ValueError:
lowest_passing_grade = None
display_name = course.display_name
start = course.start
end = course.end
if isinstance(course.id, CCXLocator):
from ccx.utils import get_ccx_from_ccx_locator # pylint: disable=import-error
ccx = get_ccx_from_ccx_locator(course.id)
display_name = ccx.display_name
start = ccx.start
end = ccx.due
return cls(
version=cls.VERSION,
id=course.id,
_location=course.location,
display_name=course.display_name,
display_name=display_name,
display_number_with_default=course.display_number_with_default,
display_org_with_default=course.display_org_with_default,
start=course.start,
end=course.end,
start=start,
end=end,
advertised_start=course.advertised_start,
course_image_url=course_image_url(course),