Use a standard function to find out if a course has ended
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user