Merge pull request #26765 from edx/AA-304

Check course outline and course date toggles in addition to courseware toggle for streak
This commit is contained in:
Matthew Piatetsky
2021-03-01 11:02:50 -05:00
committed by GitHub
2 changed files with 4 additions and 6 deletions

View File

@@ -76,7 +76,7 @@ from lms.djangoapps.courseware.models import (
OrgDynamicUpgradeDeadlineConfiguration,
)
from lms.djangoapps.courseware.toggles import (
courseware_mfe_streak_celebration_is_active,
streak_celebration_is_active,
COURSEWARE_PROCTORING_IMPROVEMENTS,
)
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
@@ -3211,9 +3211,8 @@ class UserCelebration(TimeStampedModel):
def _get_celebration(cls, user, course_key):
""" Retrieve (or create) the celebration for the provided user and course_key """
try:
# 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 and has milestones enabled.
if not courseware_mfe_streak_celebration_is_active(course_key):
# Only enable the streak if milestones and the streak are enabled for this course
if not streak_celebration_is_active(course_key):
return None
return user.celebration
except (cls.DoesNotExist, User.celebration.RelatedObjectDoesNotExist): # pylint: disable=no-member

View File

@@ -162,9 +162,8 @@ def courseware_mfe_first_section_celebration_is_active(course_key):
)
def courseware_mfe_streak_celebration_is_active(course_key):
def streak_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_STREAK_CELEBRATION.is_enabled(course_key)
)