Merge pull request #19968 from edx/PROD-58

handle incorrectly set schedules
This commit is contained in:
Matthew Piatetsky
2019-03-12 12:16:03 -04:00
committed by GitHub
4 changed files with 12 additions and 4 deletions

View File

@@ -77,6 +77,14 @@ def get_user_course_expiration_date(user, course):
# for most people. Using the schedule date will provide flexibility to deal with
# more complex business rules in the future.
content_availability_date = enrollment.schedule.start
# We have anecdotally observed a case where the schedule.start was
# equal to the course start, but should have been equal to the enrollment start
# https://openedx.atlassian.net/browse/PROD-58
# This section is meant to address that case
if enrollment.created and course.start:
if (content_availability_date.date() == course.start.date() and
course.start < enrollment.created < timezone.now()):
content_availability_date = enrollment.created
except CourseEnrollment.schedule.RelatedObjectDoesNotExist:
content_availability_date = max(enrollment.created, course.start)