Skip to content
Snippets Groups Projects
Unverified Commit 11f13476 authored by Dillon Dumesnil's avatar Dillon Dumesnil
Browse files

AA-422: Ensure learners are not receiving updates after course end

parent fe9395bd
No related branches found
Tags release-2020-11-25-04.25
No related merge requests found
......@@ -473,6 +473,10 @@ class CourseNextSectionUpdate(PrefixedDebugLoggerMixin, RecipientResolver):
template_context = get_base_template_context(self.site)
for schedule in schedules:
course = schedule.enrollment.course
# We don't want to show any updates if the course has ended so we short circuit here.
if course.end and course.end.date() <= target_date:
return
user = schedule.enrollment.user
start_date = max(filter(None, (schedule.start_date, course.start)))
LOG.info('Received a schedule for user {} in course {} for date {}'.format(
......
......@@ -252,3 +252,11 @@ class TestCourseNextSectionUpdateResolver(SchedulesResolverTestMixin, ModuleStor
log_message = ('Next Section Course Update: Last section was reached. '
'There are no more highlights for {}'.format(self.course.id))
log_capture.check_present((LOG.name, 'WARNING', log_message))
@override_waffle_flag(COURSE_UPDATE_WAFFLE_FLAG, True)
def test_no_updates_if_course_ended(self):
self.course.end = self.yesterday
self.course = self.update_course(self.course, self.user.id)
resolver = self.create_resolver()
schedules = list(resolver.get_schedules())
self.assertListEqual(schedules, [])
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