AA-454 and AA-470: Update language and bug fix for highlights

Since Course Highlights aren't necessarily weekly (self-paced courses),
update the language to be more generic. And then includes a bug fix to
not send highlights to learners after they have unenrolled from a course.
This commit is contained in:
Dillon Dumesnil
2020-12-04 13:24:26 +00:00
parent ef5832bc74
commit 9e2eab506f
6 changed files with 26 additions and 7 deletions

View File

@@ -273,7 +273,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
},
getTitle: function() {
return gettext('Enable Weekly Highlight Emails');
return gettext('Enable Course Highlight Emails');
},
getIntroductionMessage: function() {

View File

@@ -1,6 +1,6 @@
<div class="course-highlights-setting">
<h2 id="highlights-enabled-label" class="status-highlights-enabled-label">
<%- gettext('Weekly Highlight Emails') %>
<%- gettext('Course Highlight Emails') %>
</h2>
<br>
<% if (highlights_enabled_for_messaging) { %>

View File

@@ -1,7 +1,7 @@
<p>
<%- gettext(
'When you enable weekly highlight emails, learners ' +
'automatically receive weekly email messages for each section that ' +
'When you enable course highlight emails, learners ' +
'automatically receive email messages for each section that ' +
'has highlights. You cannot disable highlights after you start ' +
'sending them.'
) %>
@@ -10,7 +10,7 @@
<% // xss-lint: disable=underscore-not-escaped %>
<%= edx.HtmlUtils.interpolateHtml(
gettext(
'Are you sure you want to enable weekly highlight emails? '
'Are you sure you want to enable course highlight emails? '
+ '{linkStart}Learn more.{linkEnd}'
),
{

View File

@@ -1,5 +1,5 @@
"""
Contains methods for accessing weekly course highlights. Weekly highlights is a
Contains methods for accessing course highlights. Course highlights is a
schedule experience built on the Schedules app.
"""

View File

@@ -471,6 +471,7 @@ class CourseNextSectionUpdate(PrefixedDebugLoggerMixin, RecipientResolver):
schedules = Schedule.objects.select_related('enrollment').filter(
self.experience_filter,
active=True,
enrollment__is_active=True,
enrollment__course_id=self.course_id,
enrollment__user__is_active=True,
start_date__gte=target_date - course_duration,

View File

@@ -23,7 +23,7 @@ from openedx.core.djangoapps.schedules.models import ScheduleExperience
from openedx.core.djangoapps.schedules.utils import reset_self_paced_schedule
from openedx.core.djangoapps.theming.helpers import get_current_site
from common.djangoapps.student.models import CourseEnrollment
from common.djangoapps.student.signals import ENROLLMENT_TRACK_UPDATED
from common.djangoapps.student.signals import ENROLL_STATUS_CHANGE, ENROLLMENT_TRACK_UPDATED
from common.djangoapps.track import segment
from .config import CREATE_SCHEDULE_WAFFLE_FLAG
@@ -61,6 +61,24 @@ def create_schedule(sender, **kwargs): # pylint: disable=unused-argument
))
@receiver(ENROLL_STATUS_CHANGE)
def update_schedule(sender, event, user, course_id, **kwargs): # pylint: disable=unused-argument
"""
When a CourseEnrollment's status is updated, update the Schedule's active status if configured.
"""
try:
schedule = Schedule.objects.get(enrollment__user=user, enrollment__course=course_id)
except Schedule.DoesNotExist:
# Exit since it could just be an indication of Schedules are not enabled.
return
if event == 'enroll':
schedule.active = True
elif event == 'unenroll':
schedule.active = False
schedule.save()
@receiver(COURSE_START_DATE_CHANGED)
def update_schedules_on_course_start_changed(sender, updated_course_overview, previous_start_date, **kwargs): # pylint: disable=unused-argument
"""