Merge pull request #25381 from edx/tuchfarber/add_exec_ed_course_mdoe

Add Executive Education course mode
This commit is contained in:
Matt Tuchfarber
2020-10-27 10:09:30 -04:00
committed by GitHub
7 changed files with 44 additions and 14 deletions

View File

@@ -133,13 +133,14 @@ class CourseMode(models.Model):
history = HistoricalRecords()
HONOR = u'honor'
PROFESSIONAL = u'professional'
VERIFIED = u'verified'
AUDIT = u'audit'
NO_ID_PROFESSIONAL_MODE = u'no-id-professional'
CREDIT_MODE = u'credit'
MASTERS = u'masters'
HONOR = 'honor'
PROFESSIONAL = 'professional'
VERIFIED = 'verified'
AUDIT = 'audit'
NO_ID_PROFESSIONAL_MODE = 'no-id-professional'
CREDIT_MODE = 'credit'
MASTERS = 'masters'
EXECUTIVE_EDUCATION = 'executive-education'
DEFAULT_MODE = Mode(
settings.COURSE_MODE_DEFAULTS['slug'],
@@ -154,13 +155,22 @@ class CourseMode(models.Model):
)
DEFAULT_MODE_SLUG = settings.COURSE_MODE_DEFAULTS['slug']
ALL_MODES = [AUDIT, CREDIT_MODE, HONOR, NO_ID_PROFESSIONAL_MODE, PROFESSIONAL, VERIFIED, MASTERS, ]
ALL_MODES = [
AUDIT,
CREDIT_MODE,
HONOR,
NO_ID_PROFESSIONAL_MODE,
PROFESSIONAL,
VERIFIED,
MASTERS,
EXECUTIVE_EDUCATION
]
# Modes utilized for audit/free enrollments
AUDIT_MODES = [AUDIT, HONOR]
# Modes that allow a student to pursue a verified certificate
VERIFIED_MODES = [VERIFIED, PROFESSIONAL, MASTERS]
VERIFIED_MODES = [VERIFIED, PROFESSIONAL, MASTERS, EXECUTIVE_EDUCATION]
# Modes that allow a student to pursue a non-verified certificate
NON_VERIFIED_MODES = [HONOR, AUDIT, NO_ID_PROFESSIONAL_MODE]
@@ -169,7 +179,7 @@ class CourseMode(models.Model):
CREDIT_MODES = [CREDIT_MODE]
# Modes that are eligible to purchase credit
CREDIT_ELIGIBLE_MODES = [VERIFIED, PROFESSIONAL, NO_ID_PROFESSIONAL_MODE]
CREDIT_ELIGIBLE_MODES = [VERIFIED, PROFESSIONAL, NO_ID_PROFESSIONAL_MODE, EXECUTIVE_EDUCATION]
# Modes for which certificates/programs may need to be updated
CERTIFICATE_RELEVANT_MODES = CREDIT_MODES + CREDIT_ELIGIBLE_MODES + [MASTERS]

View File

@@ -263,9 +263,17 @@ class GeneratedCertificate(models.Model):
# results. Django requires us to explicitly declare this.
objects = models.Manager()
MODES = Choices(u'verified', u'honor', u'audit', u'professional', u'no-id-professional', u'masters')
MODES = Choices(
'verified',
'honor',
'audit',
'professional',
'no-id-professional',
'masters',
'executive-education'
)
VERIFIED_CERTS_MODES = [CourseMode.VERIFIED, CourseMode.CREDIT_MODE, CourseMode.MASTERS]
VERIFIED_CERTS_MODES = [CourseMode.VERIFIED, CourseMode.CREDIT_MODE, CourseMode.MASTERS, CourseMode.EXECUTIVE_EDUCATION]
user = models.ForeignKey(User, on_delete=models.CASCADE)
course_id = CourseKeyField(max_length=255, blank=True, default=None)

View File

@@ -155,6 +155,7 @@ def fire_ungenerated_certificate_task(user, course_key, expected_verification_st
CourseMode.PROFESSIONAL,
CourseMode.NO_ID_PROFESSIONAL_MODE,
CourseMode.MASTERS,
CourseMode.EXECUTIVE_EDUCATION,
]
enrollment_mode, __ = CourseEnrollment.enrollment_mode_for_user(user, course_key)
cert = GeneratedCertificate.certificate_for_student(user, course_key)

View File

@@ -37,7 +37,7 @@ def is_track_ok_for_exam(user, exam):
"""
course_id = CourseKey.from_string(exam['course_id'])
mode, is_active = CourseEnrollment.enrollment_mode_for_user(user, course_id)
return is_active and mode in (CourseMode.VERIFIED, CourseMode.MASTERS, CourseMode.PROFESSIONAL)
return is_active and mode in (CourseMode.VERIFIED, CourseMode.MASTERS, CourseMode.PROFESSIONAL, CourseMode.EXECUTIVE_EDUCATION)
# The edx_proctoring.api uses this permission to gate access to the

View File

@@ -217,7 +217,7 @@ def get_enrollments_for_courses_in_program(user, program):
return CourseEnrollment.objects.filter(
user=user,
course_id__in=course_keys,
mode__in=[CourseMode.VERIFIED, CourseMode.MASTERS],
mode__in=[CourseMode.VERIFIED, CourseMode.MASTERS, CourseMode.EXECUTIVE_EDUCATION],
is_active=True,
)

View File

@@ -3911,6 +3911,12 @@ COURSE_ENROLLMENT_MODES = {
"display_name": _("Master's"),
"min_price": 0,
},
"executive-education": {
"id": 8,
"slug": "executive-educations",
"display_name": _("Executive Education"),
"min_price": 1
}
}
CONTENT_TYPE_GATE_GROUP_IDS = {

View File

@@ -24,6 +24,11 @@ from openedx.core.djangolib.markup import HTML, Text
<tr>
<th scope="row">${_("Professional")}</th><td>${modes['professional'] + modes['no-id-professional']}</td>
</tr>
%if modes["executive-education"] > 0:
<tr>
<th scope="row">${_("Executive Education")}</th><td>${modes['executive-education']}</td>
</tr>
%endif
%if modes['masters'] > 0:
<tr>
<th scope="row">${_("Master's")}</th><td>${modes['masters']}</td>