Commit c21b3c8f by Nimisha Asthagiri Committed by GitHub

Merge pull request #15323 from edx/ret/exclude-non-english-courses

Planning Prompts experiment: exclude non-English courses
parents 1904a93a d465d6f7
...@@ -525,7 +525,7 @@ class CourseTabView(EdxFragmentView): ...@@ -525,7 +525,7 @@ class CourseTabView(EdxFragmentView):
# TODO: (Experimental Code). See https://openedx.atlassian.net/wiki/display/RET/3.+Planning+Prompts # TODO: (Experimental Code). See https://openedx.atlassian.net/wiki/display/RET/3.+Planning+Prompts
def _should_display_planning_prompt(request, course_overview): def _should_display_planning_prompt(request, course):
""" """
A planning prompt is enabled in the experiment for all enrollments whose A planning prompt is enabled in the experiment for all enrollments whose
content availability date is less than 14 days from today. content availability date is less than 14 days from today.
...@@ -533,12 +533,13 @@ def _should_display_planning_prompt(request, course_overview): ...@@ -533,12 +533,13 @@ def _should_display_planning_prompt(request, course_overview):
The content availability date is defined as either the course start date The content availability date is defined as either the course start date
or the enrollment date, whichever was most recent. or the enrollment date, whichever was most recent.
""" """
enrollment = CourseEnrollment.get_enrollment(request.user, course_overview.id) is_course_in_english = not course.language or course.language.lower() == u'en'
if enrollment: if is_course_in_english:
content_availability_date = max(course_overview.start, enrollment.created) enrollment = CourseEnrollment.get_enrollment(request.user, course.id)
return content_availability_date > (datetime.now(utc) - timedelta(days=14)) if enrollment and enrollment.is_active:
else: content_availability_date = max(course.start, enrollment.created)
return False return content_availability_date > (datetime.now(utc) - timedelta(days=14))
return False
# ENDTODO # ENDTODO
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment