Skip to content
Snippets Groups Projects
Commit 080f04c1 authored by Carla Duarte's avatar Carla Duarte
Browse files

AA-371: Progress Milestone Waffle Flags

parent e0de14bc
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ from django.db import IntegrityError
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from lms.djangoapps.courseware.toggles import REDIRECT_TO_COURSEWARE_MICROFRONTEND
from lms.djangoapps.courseware.toggles import courseware_mfe_first_section_celebration_is_active
from student.helpers import EMAIL_EXISTS_MSG_FMT, USERNAME_EXISTS_MSG_FMT, AccountValidationError
from student.models import CourseEnrollment, CourseEnrollmentCelebration, is_email_retired, is_username_retired
......@@ -58,8 +58,8 @@ def create_course_enrollment_celebration(sender, instance, created, **kwargs):
return
# The UI for celebrations is only supported on the MFE right now, so don't turn on
# celebrations unless this enrollment's course is MFE-enabled.
if not REDIRECT_TO_COURSEWARE_MICROFRONTEND.is_enabled(instance.course_id):
# celebrations unless this enrollment's course is MFE-enabled and has milestones enabled.
if not courseware_mfe_first_section_celebration_is_active(instance.course_id):
return
try:
......
""" Tests for student signal receivers. """
from lms.djangoapps.courseware.toggles import REDIRECT_TO_COURSEWARE_MICROFRONTEND
from lms.djangoapps.courseware.toggles import (
REDIRECT_TO_COURSEWARE_MICROFRONTEND,
COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES,
COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES_FIRST_SECTION_CELEBRATION
)
from student.models import CourseEnrollmentCelebration
from student.tests.factories import CourseEnrollmentFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
......@@ -11,6 +15,8 @@ class ReceiversTest(SharedModuleStoreTestCase):
Tests for dashboard utility functions
"""
@REDIRECT_TO_COURSEWARE_MICROFRONTEND.override(active=True)
@COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES.override(active=True)
@COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES_FIRST_SECTION_CELEBRATION.override(active=True)
def test_celebration_created(self):
""" Test that we make celebration objects when enrollments are created """
self.assertEqual(CourseEnrollmentCelebration.objects.count(), 0)
......
......@@ -55,9 +55,47 @@ COURSEWARE_MICROFRONTEND_COURSE_EXIT_PAGE = CourseWaffleFlag(
WAFFLE_FLAG_NAMESPACE, 'microfrontend_course_exit_page', __name__
)
# .. toggle_name: courseware.mfe_progress_milestones
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
# .. toggle_description: Waffle flag to display learner progress milestones in a course. Supports staged
# rollout to students for a new micro-frontend-based implementation of the courseware page.
# .. toggle_use_cases: temporary, open_edx
# .. toggle_creation_date: 2020-10-07
# .. toggle_target_removal_date: none
# .. toggle_warnings: Also set settings.LEARNING_MICROFRONTEND_URL and ENABLE_COURSEWARE_MICROFRONTEND.
# .. toggle_tickets: AA-371
COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES = CourseWaffleFlag(
WAFFLE_FLAG_NAMESPACE, 'mfe_progress_milestones', __name__
)
# .. toggle_name: courseware.mfe_progress_milestones_first_section_celebration
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
# .. toggle_description: Waffle flag to display a celebration modal on learner completion of their first section.
# Supports staged rollout to students for a new micro-frontend-based implementation of the
# courseware page.
# .. toggle_use_cases: temporary, open_edx
# .. toggle_creation_date: 2020-10-07
# .. toggle_target_removal_date: none
# .. toggle_warnings: Also set settings.LEARNING_MICROFRONTEND_URL and ENABLE_COURSEWARE_MICROFRONTEND and
# COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES.
# .. toggle_tickets: AA-371
COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES_FIRST_SECTION_CELEBRATION = CourseWaffleFlag(
WAFFLE_FLAG_NAMESPACE, 'mfe_progress_milestones_first_section_celebration', __name__
)
def course_exit_page_is_active(course_key):
return (
REDIRECT_TO_COURSEWARE_MICROFRONTEND.is_enabled(course_key) and
COURSEWARE_MICROFRONTEND_COURSE_EXIT_PAGE.is_enabled(course_key)
)
def courseware_mfe_first_section_celebration_is_active(course_key):
return (
REDIRECT_TO_COURSEWARE_MICROFRONTEND.is_enabled(course_key) and
COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES.is_enabled(course_key) and
COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES_FIRST_SECTION_CELEBRATION.is_enabled(course_key)
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment