Merge pull request #19968 from edx/PROD-58
handle incorrectly set schedules
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user