Use a standard function to find out if a course has ended

This commit is contained in:
Calen Pennington
2020-06-11 09:11:15 -04:00
parent 1cf46e76d0
commit 86e2677f26
5 changed files with 6 additions and 6 deletions

View File

@@ -84,7 +84,7 @@ class DatesTabView(RetrieveAPIView):
user_timezone = user_timezone_locale['user_timezone']
data = {
'is_archived': course.end and course.end < datetime.now(),
'has_ended': course.has_ended(),
'course_date_blocks': [block for block in blocks if not isinstance(block, TodaysDate)],
'missed_deadlines': missed_deadlines,
'missed_gated_content': missed_gated_content,

View File

@@ -1082,7 +1082,7 @@ def dates(request, course_id):
'reset_deadlines_url': reverse(RESET_COURSE_DEADLINES_NAME),
'reset_deadlines_redirect_url_base': COURSE_DATES_NAME,
'reset_deadlines_redirect_url_id_dict': {'course_id': str(course.id)},
'is_archived': course.end and course.end < datetime.now(),
'has_ended': course.has_ended(),
}
return render_to_response('courseware/dates.html', context)
@@ -1681,7 +1681,7 @@ def render_xblock(request, usage_key_string, check_if_enrolled=True):
'xqa_server': settings.FEATURES.get('XQA_SERVER', 'http://your_xqa_server.com'),
'missed_deadlines': missed_deadlines,
'missed_gated_content': missed_gated_content,
'is_archived': course.end and course.end < datetime.now(),
'has_ended': course.has_ended(),
'web_app_course_url': reverse(COURSE_HOME_VIEW_NAME, args=[course.id]),
'on_courseware_page': True,
'verified_upgrade_link': verified_upgrade_deadline_link(request.user, course=course),

View File

@@ -86,7 +86,7 @@ additional_styling_class = 'on-mobile' if is_mobile_app else 'has-button'
</div>
</%def>
% if not is_archived:
% if not has_ended:
% if on_dates_tab and not missed_deadlines:
%if getattr(course, 'self_paced', False):
<div class="dates-banner">

View File

@@ -794,7 +794,7 @@ class TestProgramDataExtender(ModuleStoreTestCase):
'certificate_url': None,
'course_url': reverse('course_root', args=[self.course.id]),
'enrollment_open_date': strftime_localized(DEFAULT_ENROLLMENT_START_DATE, 'SHORT_DATE'),
'is_course_ended': self.course.end and self.course.end < datetime.datetime.now(utc),
'is_course_ended': self.course.has_ended(),
'is_enrolled': False,
'is_enrollment_open': True,
'upgrade_url': None,

View File

@@ -101,7 +101,7 @@ class CourseOutlineFragmentView(EdxFragmentView):
'on_course_outline_page': True,
'missed_deadlines': missed_deadlines,
'missed_gated_content': missed_gated_content,
'is_archived': course.end and course.end < datetime.now(),
'has_ended': course.has_ended(),
}
html = render_to_string('course_experience/course-outline-fragment.html', context)