- % if use_v2_cert_display_settings:
-
- % else:
-
- % endif
+
${_("Certificates are awarded at the end of a course run")}
- % if use_v2_cert_display_settings:
-
-
-
-
-
- ${_("Read more about this setting")}
-
+
+
+
+
+
+ ${_("Read more about this setting")}
+
+
+
+
${_("In all configurations of this setting, certificates are generated for learners as soon as they achieve the passing threshold in the course (which can occur before a final assignment based on course design)")}
+
+
${_("Immediately upon passing")}
+
${_("Learners can access their certificate as soon as they achieve a passing grade above the course grade threshold. Note: learners can achieve a passing grade before encountering all assignments in some course configurations.")}
-
-
${_("In all configurations of this setting, certificates are generated for learners as soon as they achieve the passing threshold in the course (which can occur before a final assignment based on course design)")}
-
-
${_("Immediately upon passing")}
-
${_("Learners can access their certificate as soon as they achieve a passing grade above the course grade threshold. Note: learners can achieve a passing grade before encountering all assignments in some course configurations.")}
-
-
-
${_("On course end date")}
-
${_("Learners with passing grades can access their certificate once the end date of the course has elapsed.")}
-
-
-
${_("A date after the course end date")}
-
${_("Learners with passing grades can access their certificate after the date that you set has elapsed.")}
-
+
+
${_("On course end date")}
+
${_("Learners with passing grades can access their certificate once the end date of the course has elapsed.")}
+
+
+
${_("A date after the course end date")}
+
${_("Learners with passing grades can access their certificate after the date that you set has elapsed.")}
- % endif
+
- % if use_v2_cert_display_settings:
-
- % else:
-
- % endif
+
diff --git a/common/djangoapps/student/helpers.py b/common/djangoapps/student/helpers.py
index fb0a7236c0b..b1ace4ef7e0 100644
--- a/common/djangoapps/student/helpers.py
+++ b/common/djangoapps/student/helpers.py
@@ -646,22 +646,14 @@ def _is_certificate_earned_but_not_available(course_overview, status):
(bool): True if the user earned the certificate but it's hidden due to display behavior, else False
"""
- if settings.FEATURES.get("ENABLE_V2_CERT_DISPLAY_SETTINGS"):
- return (
- not certificates_viewable_for_course(course_overview)
- and CertificateStatuses.is_passing_status(status)
- and course_overview.certificates_display_behavior in (
- CertificatesDisplayBehaviors.END_WITH_DATE,
- CertificatesDisplayBehaviors.END
- )
- )
- else:
- return (
- not certificates_viewable_for_course(course_overview) and
- CertificateStatuses.is_passing_status(status) and
- course_overview.certificate_available_date
+ return (
+ not certificates_viewable_for_course(course_overview)
+ and CertificateStatuses.is_passing_status(status)
+ and course_overview.certificates_display_behavior in (
+ CertificatesDisplayBehaviors.END_WITH_DATE,
+ CertificatesDisplayBehaviors.END
)
-
+ )
def process_survey_link(survey_link, user):
"""
diff --git a/lms/djangoapps/certificates/api.py b/lms/djangoapps/certificates/api.py
index 4439eeb5f22..4987e061bfb 100644
--- a/lms/djangoapps/certificates/api.py
+++ b/lms/djangoapps/certificates/api.py
@@ -286,12 +286,9 @@ def certificate_downloadable_status(student, course_key):
course_overview = get_course_overview_or_none(course_key)
- if settings.FEATURES.get("ENABLE_V2_CERT_DISPLAY_SETTINGS"):
- display_behavior_is_valid = (
- course_overview.certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE
- )
- else:
- display_behavior_is_valid = True
+ display_behavior_is_valid = (
+ course_overview.certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE
+ )
if (
not certificates_viewable_for_course(course_overview)
@@ -837,10 +834,7 @@ def can_show_certificate_message(course, student, course_grade, certificates_ena
def _course_uses_available_date(course):
"""Returns if the course has an certificate_available_date set and that it should be used"""
- if settings.FEATURES.get("ENABLE_V2_CERT_DISPLAY_SETTINGS"):
- display_behavior_is_valid = course.certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE
- else:
- display_behavior_is_valid = True
+ display_behavior_is_valid = course.certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE
return (
can_show_certificate_available_date_field(course)
diff --git a/lms/djangoapps/certificates/tests/test_api.py b/lms/djangoapps/certificates/tests/test_api.py
index 21d04a7e3da..4bbfeb90467 100644
--- a/lms/djangoapps/certificates/tests/test_api.py
+++ b/lms/djangoapps/certificates/tests/test_api.py
@@ -209,28 +209,6 @@ def test_with_downloadable_web_cert(self):
"uuid": cert_status["uuid"],
}
- @ddt.data(
- (False, timedelta(days=2), False, True),
- (False, -timedelta(days=2), True, None),
- (True, timedelta(days=2), True, None),
- )
- @ddt.unpack
- @patch.dict(settings.FEATURES, {"CERTIFICATES_HTML_VIEW": True})
- @patch.dict(settings.FEATURES, {"ENABLE_V2_CERT_DISPLAY_SETTINGS": False})
- def test_cert_api_return_v1(self, self_paced, cert_avail_delta, cert_downloadable_status, earned_but_not_available):
- """
- Test 'downloadable status'
- """
- cert_avail_date = datetime.now(pytz.UTC) + cert_avail_delta
- self.course.self_paced = self_paced
- self.course.certificate_available_date = cert_avail_date
- self.course.save()
-
- self._setup_course_certificate()
-
- downloadable_status = certificate_downloadable_status(self.student, self.course.id)
- assert downloadable_status["is_downloadable"] == cert_downloadable_status
- assert downloadable_status.get("earned_but_not_available") == earned_but_not_available
@ddt.data(
(True, timedelta(days=2), CertificatesDisplayBehaviors.END_WITH_DATE, True, None),
@@ -243,8 +221,7 @@ def test_cert_api_return_v1(self, self_paced, cert_avail_delta, cert_downloadabl
)
@ddt.unpack
@patch.dict(settings.FEATURES, {"CERTIFICATES_HTML_VIEW": True})
- @patch.dict(settings.FEATURES, {"ENABLE_V2_CERT_DISPLAY_SETTINGS": True})
- def test_cert_api_return_v2(
+ def test_cert_api_return(
self,
self_paced,
cert_avail_delta,
diff --git a/lms/djangoapps/certificates/tests/test_utils.py b/lms/djangoapps/certificates/tests/test_utils.py
index 00bb0bbe3ed..6d58b3069cb 100644
--- a/lms/djangoapps/certificates/tests/test_utils.py
+++ b/lms/djangoapps/certificates/tests/test_utils.py
@@ -80,40 +80,7 @@ def test_has_html_certificates_enabled_from_course_overview_disabled(self):
(CertificatesDisplayBehaviors.END, False, False, _LAST_MONTH, True, True),
)
@ddt.unpack
- @patch.dict(settings.FEATURES, ENABLE_V2_CERT_DISPLAY_SETTINGS=True)
- def test_should_certificate_be_visible_v2(
- self,
- certificates_display_behavior,
- certificates_show_before_end,
- has_ended,
- certificate_available_date,
- self_paced,
- expected_value
- ):
- """Test whether the certificate should be visible to user given multiple usecases"""
- assert should_certificate_be_visible(
- certificates_display_behavior,
- certificates_show_before_end,
- has_ended,
- certificate_available_date,
- self_paced
- ) == expected_value
-
- @ddt.data(
- ('early_with_info', True, True, _LAST_MONTH, False, True),
- ('early_no_info', False, False, _LAST_MONTH, False, True),
- ('end', True, False, _LAST_MONTH, False, True),
- ('end', False, True, _LAST_MONTH, False, True),
- ('end', False, False, _NEXT_WEEK, False, False),
- ('end', False, False, _LAST_WEEK, False, True),
- ('end', False, False, None, False, False),
- ('early_with_info', False, False, None, False, True),
- ('end', False, False, _NEXT_WEEK, False, False),
- ('end', False, False, _NEXT_WEEK, True, True),
- )
- @ddt.unpack
- @patch.dict(settings.FEATURES, ENABLE_V2_CERT_DISPLAY_SETTINGS=False)
- def test_should_certificate_be_visible_v1(
+ def test_should_certificate_be_visible(
self,
certificates_display_behavior,
certificates_show_before_end,
diff --git a/lms/djangoapps/certificates/utils.py b/lms/djangoapps/certificates/utils.py
index 725c54ac09b..7ff2a4c97b2 100644
--- a/lms/djangoapps/certificates/utils.py
+++ b/lms/djangoapps/certificates/utils.py
@@ -153,30 +153,19 @@ def should_certificate_be_visible(
certificate_available_date (datetime): the date the certificate is available on for the course.
self_paced (bool): Whether the course is self-paced.
"""
- if settings.FEATURES.get("ENABLE_V2_CERT_DISPLAY_SETTINGS"):
- show_early = (
- certificates_display_behavior == CertificatesDisplayBehaviors.EARLY_NO_INFO
- or certificates_show_before_end
- )
- past_available_date = (
- certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE
- and certificate_available_date
- and certificate_available_date < datetime.now(utc)
- )
- ended_without_available_date = (
- certificates_display_behavior == CertificatesDisplayBehaviors.END
- and has_ended
- )
- else:
- show_early = (
- certificates_display_behavior in ('early_with_info', 'early_no_info')
- or certificates_show_before_end
- )
- past_available_date = (
- certificate_available_date
- and certificate_available_date < datetime.now(utc)
- )
- ended_without_available_date = (certificate_available_date is None) and has_ended
+ show_early = (
+ certificates_display_behavior == CertificatesDisplayBehaviors.EARLY_NO_INFO
+ or certificates_show_before_end
+ )
+ past_available_date = (
+ certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE
+ and certificate_available_date
+ and certificate_available_date < datetime.now(utc)
+ )
+ ended_without_available_date = (
+ certificates_display_behavior == CertificatesDisplayBehaviors.END
+ and has_ended
+ )
return any((self_paced, show_early, past_available_date, ended_without_available_date))
diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py
index 40a1f449930..06e4e8a5533 100644
--- a/lms/djangoapps/certificates/views/webview.py
+++ b/lms/djangoapps/certificates/views/webview.py
@@ -353,28 +353,22 @@ def _get_user_certificate(request, user, course_key, course_overview, preview_mo
if preview_mode:
# certificate is being previewed from studio
if request.user.has_perm(PREVIEW_CERTIFICATES, course_overview):
- if not settings.FEATURES.get("ENABLE_V2_CERT_DISPLAY_SETTINGS"):
- if course_overview.certificate_available_date and not course_overview.self_paced:
- modified_date = course_overview.certificate_available_date
- else:
- modified_date = datetime.now().date()
+ if (
+ course_overview.certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE
+ and course_overview.certificate_available_date
+ and not course_overview.self_paced
+ ):
+ modified_date = course_overview.certificate_available_date
+ elif course_overview.certificates_display_behavior == CertificatesDisplayBehaviors.END:
+ modified_date = course_overview.end
else:
- if (
- course_overview.certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE
- and course_overview.certificate_available_date
- and not course_overview.self_paced
- ):
- modified_date = course_overview.certificate_available_date
- elif course_overview.certificates_display_behavior == CertificatesDisplayBehaviors.END:
- modified_date = course_overview.end
- else:
- modified_date = datetime.now().date()
- user_certificate = GeneratedCertificate(
- mode=preview_mode,
- verify_uuid=str(uuid4().hex),
- modified_date=modified_date,
- created_date=datetime.now().date(),
- )
+ modified_date = datetime.now().date()
+ user_certificate = GeneratedCertificate(
+ mode=preview_mode,
+ verify_uuid=str(uuid4().hex),
+ modified_date=modified_date,
+ created_date=datetime.now().date(),
+ )
elif certificates_viewable_for_course(course_overview):
# certificate is being viewed by learner or public
try:
diff --git a/lms/djangoapps/learner_home/serializers.py b/lms/djangoapps/learner_home/serializers.py
index 3d156f3640c..78bc51043ab 100644
--- a/lms/djangoapps/learner_home/serializers.py
+++ b/lms/djangoapps/learner_home/serializers.py
@@ -301,21 +301,18 @@ def get_availableDate(self, enrollment):
course_overview = enrollment.course_overview
available_date = course_overview.certificate_available_date
- if settings.FEATURES.get("ENABLE_V2_CERT_DISPLAY_SETTINGS", False):
- if (
- course_overview.certificates_display_behavior
- == CertificatesDisplayBehaviors.END_WITH_DATE
- and course_overview.certificate_available_date
- ):
- available_date = course_overview.certificate_available_date
- elif (
- course_overview.certificates_display_behavior
- == CertificatesDisplayBehaviors.END
- and course_overview.end
- ):
- available_date = course_overview.end
- else:
+ if (
+ course_overview.certificates_display_behavior
+ == CertificatesDisplayBehaviors.END_WITH_DATE
+ and course_overview.certificate_available_date
+ ):
available_date = course_overview.certificate_available_date
+ elif (
+ course_overview.certificates_display_behavior
+ == CertificatesDisplayBehaviors.END
+ and course_overview.end
+ ):
+ available_date = course_overview.end
return serializers.DateTimeField().to_representation(available_date)
diff --git a/lms/djangoapps/learner_home/test_serializers.py b/lms/djangoapps/learner_home/test_serializers.py
index ac11a8b2990..14383946cb5 100644
--- a/lms/djangoapps/learner_home/test_serializers.py
+++ b/lms/djangoapps/learner_home/test_serializers.py
@@ -544,23 +544,6 @@ def test_with_data(self):
},
)
- @mock.patch.dict(settings.FEATURES, ENABLE_V2_CERT_DISPLAY_SETTINGS=False)
- def test_available_date_old_format(self):
- # Given new cert display settings are not enabled
- input_data = self.create_test_enrollment(course_mode=CourseMode.VERIFIED)
- input_data.course.certificate_available_date = random_date()
- input_context = self.create_test_context(input_data.course)
-
- # When I get certificate info
- output_data = CertificateSerializer(input_data, context=input_context).data
-
- # Then the available date is defaulted to the certificate available date
- expected_available_date = datetime_to_django_format(
- input_data.course.certificate_available_date
- )
- self.assertEqual(output_data["availableDate"], expected_available_date)
-
- @mock.patch.dict(settings.FEATURES, ENABLE_V2_CERT_DISPLAY_SETTINGS=True)
def test_available_date_course_end(self):
# Given new cert display settings are enabled
input_data = self.create_test_enrollment(course_mode=CourseMode.VERIFIED)
@@ -578,7 +561,6 @@ def test_available_date_course_end(self):
expected_available_date = datetime_to_django_format(input_data.course.end)
self.assertEqual(output_data["availableDate"], expected_available_date)
- @mock.patch.dict(settings.FEATURES, ENABLE_V2_CERT_DISPLAY_SETTINGS=True)
def test_available_date_specific_end(self):
# Given new cert display settings are enabled
input_data = self.create_test_enrollment(course_mode=CourseMode.VERIFIED)
diff --git a/lms/envs/common.py b/lms/envs/common.py
index f2bcfa822b6..df8878f2691 100644
--- a/lms/envs/common.py
+++ b/lms/envs/common.py
@@ -949,17 +949,6 @@
# .. toggle_tickets: 'https://openedx.atlassian.net/browse/OSPR-5290'
'ENABLE_BULK_USER_RETIREMENT': False,
- # .. toggle_name: FEATURES['ENABLE_V2_CERT_DISPLAY_SETTINGS']
- # .. toggle_implementation: DjangoSetting
- # .. toggle_default: False
- # .. toggle_description: Whether to use the reimagined certificates_display_behavior and certificate_available_date
- # .. settings. Will eventually become the default.
- # .. toggle_use_cases: temporary
- # .. toggle_creation_date: 2021-07-26
- # .. toggle_target_removal_date: 2021-10-01
- # .. toggle_tickets: 'https://openedx.atlassian.net/browse/MICROBA-1405'
- 'ENABLE_V2_CERT_DISPLAY_SETTINGS': False,
-
# .. toggle_name: FEATURES['ENABLE_INTEGRITY_SIGNATURE']
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
diff --git a/lms/templates/dashboard/_dashboard_certificate_information.html b/lms/templates/dashboard/_dashboard_certificate_information.html
index 5f3436a7f71..5e8225bdcb8 100644
--- a/lms/templates/dashboard/_dashboard_certificate_information.html
+++ b/lms/templates/dashboard/_dashboard_certificate_information.html
@@ -44,14 +44,11 @@
<%
- if settings.FEATURES.get("ENABLE_V2_CERT_DISPLAY_SETTINGS", False):
- certificate_available_date_string = ""
- if course_overview.certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE and course_overview.certificate_available_date:
- certificate_available_date_string = course_overview.certificate_available_date.strftime('%Y-%m-%dT%H:%M:%S%z')
- elif course_overview.certificates_display_behavior == CertificatesDisplayBehaviors.END and course_overview.end:
- certificate_available_date_string = course_overview.end.strftime('%Y-%m-%dT%H:%M:%S%z')
- else:
+ certificate_available_date_string = ""
+ if course_overview.certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE and course_overview.certificate_available_date:
certificate_available_date_string = course_overview.certificate_available_date.strftime('%Y-%m-%dT%H:%M:%S%z')
+ elif course_overview.certificates_display_behavior == CertificatesDisplayBehaviors.END and course_overview.end:
+ certificate_available_date_string = course_overview.end.strftime('%Y-%m-%dT%H:%M:%S%z')
container_string = _("Your grade and certificate will be ready after {date}.")
format = 'shortDate'
%>
diff --git a/openedx/core/djangoapps/models/course_details.py b/openedx/core/djangoapps/models/course_details.py
index d8d5deae011..c00d7d0b881 100644
--- a/openedx/core/djangoapps/models/course_details.py
+++ b/openedx/core/djangoapps/models/course_details.py
@@ -371,10 +371,6 @@ def validate_certificate_settings(cls, certificate_available_date, certificates_
tuple[str, str]: updated certificate_available_date, updated certificates_display_behavior
None
"""
- # If V2 is not enable, return original values
- if not settings.FEATURES.get("ENABLE_V2_CERT_DISPLAY_SETTINGS", False):
- return (certificate_available_date, certificates_display_behavior)
-
# "early_no_info" will always show regardless of settings
if certificates_display_behavior == CertificatesDisplayBehaviors.EARLY_NO_INFO:
return (None, CertificatesDisplayBehaviors.EARLY_NO_INFO)
diff --git a/openedx/core/djangoapps/models/tests/test_course_details.py b/openedx/core/djangoapps/models/tests/test_course_details.py
index 86301740c7f..a6a39b116e7 100644
--- a/openedx/core/djangoapps/models/tests/test_course_details.py
+++ b/openedx/core/djangoapps/models/tests/test_course_details.py
@@ -212,30 +212,8 @@ def test_fetch_video(self):
),
)
@ddt.unpack
- @patch.dict(settings.FEATURES, ENABLE_V2_CERT_DISPLAY_SETTINGS=True)
- def test_validate_certificate_settings_v2(self, stored_date, stored_behavior, expected_date, expected_behavior):
+ def test_validate_certificate_settings(self, stored_date, stored_behavior, expected_date, expected_behavior):
assert CourseDetails.validate_certificate_settings(
stored_date, stored_behavior
) == (expected_date, expected_behavior)
- @ddt.data(
- (
- EXAMPLE_CERTIFICATE_AVAILABLE_DATE,
- CertificatesDisplayBehaviors.END_WITH_DATE,
- EXAMPLE_CERTIFICATE_AVAILABLE_DATE,
- CertificatesDisplayBehaviors.END_WITH_DATE
- ),
- (
- None,
- "invalid_option",
- None,
- "invalid_option"
- ),
- )
- @ddt.unpack
- @patch.dict(settings.FEATURES, ENABLE_V2_CERT_DISPLAY_SETTINGS=False)
- def test_validate_certificate_settings_v1(self, stored_date, stored_behavior, expected_date, expected_behavior):
- """Test that method just returns passed in arguments if v2 is off"""
- assert CourseDetails.validate_certificate_settings(
- stored_date, stored_behavior
- ) == (expected_date, expected_behavior)
diff --git a/xmodule/course_block.py b/xmodule/course_block.py
index 46ad7476f6d..5b1f92d7773 100644
--- a/xmodule/course_block.py
+++ b/xmodule/course_block.py
@@ -1115,9 +1115,6 @@ def __init__(self, *args, **kwargs):
except InvalidTabsException as err:
raise type(err)(f'{str(err)} For course: {str(self.id)}') # lint-amnesty, pylint: disable=line-too-long
- if not settings.FEATURES.get("ENABLE_V2_CERT_DISPLAY_SETTINGS"):
- self.set_default_certificate_available_date()
-
def set_grading_policy(self, course_policy):
"""
The JSON object can have the keys GRADER and GRADE_CUTOFFS. If either is