Commit d465d6f7 by Nimisha Asthagiri

Planning Prompts experiment: exclude non-English courses

parent 09e22f37
......@@ -525,7 +525,7 @@ class CourseTabView(EdxFragmentView):
# 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
content availability date is less than 14 days from today.
......@@ -533,12 +533,13 @@ def _should_display_planning_prompt(request, course_overview):
The content availability date is defined as either the course start date
or the enrollment date, whichever was most recent.
"""
enrollment = CourseEnrollment.get_enrollment(request.user, course_overview.id)
if enrollment:
content_availability_date = max(course_overview.start, enrollment.created)
return content_availability_date > (datetime.now(utc) - timedelta(days=14))
else:
return False
is_course_in_english = not course.language or course.language.lower() == u'en'
if is_course_in_english:
enrollment = CourseEnrollment.get_enrollment(request.user, course.id)
if enrollment and enrollment.is_active:
content_availability_date = max(course.start, enrollment.created)
return content_availability_date > (datetime.now(utc) - timedelta(days=14))
return False
# 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