feat: reimagine certificate display settings The course settings `certificate_available_date` (CAD) and `certificates_display_behavior` (CDB) were previously acting indedependantly of one another. They now work in tandem. This change: - limits CDB to a dropdown - removes "early_with_info" and adds "end_with_date" - only takes CAD into account if "end_with_date" is selected - Moves CDB to the main course schedule settings page - updates CourseOverview model and CourseDetails objects to validate these fields and choose sane defaults if they aren't expected values This work was previously done in bd9e7dd (complete with bugs), so this version is toggleable via the ENABLE_V2_CERT_DISPLAY_SETTINGS setting
26 lines
713 B
Python
26 lines
713 B
Python
"""
|
|
Public data structures for this app.
|
|
|
|
See OEP-49 for details
|
|
"""
|
|
from enum import Enum
|
|
|
|
|
|
class CertificatesDisplayBehaviors(str, Enum):
|
|
"""
|
|
Options for the certificates_display_behavior field of a course
|
|
|
|
end: Certificates are available at the end of the course
|
|
end_with_date: Certificates are available after the certificate_available_date (post course end)
|
|
early_no_info: Certificates are available immediately after earning them.
|
|
|
|
Only in affect for instructor based courses.
|
|
"""
|
|
END = "end"
|
|
END_WITH_DATE = "end_with_date"
|
|
EARLY_NO_INFO = "early_no_info"
|
|
|
|
@classmethod
|
|
def includes_value(cls, value):
|
|
return value in set(item.value for item in cls)
|