Add 'format' as a requested field.
This commit is contained in:
@@ -51,26 +51,26 @@ from django.utils.translation import ugettext as _
|
||||
if subsection.get('due') is None:
|
||||
data_string = subsection.get('format')
|
||||
else:
|
||||
if 'special_exam' in subsection:
|
||||
if 'special_exam_info' in subsection:
|
||||
data_string = _('due {date}')
|
||||
else:
|
||||
data_string = _("{subsection_format} due {{date}}").format(subsection_format=subsection.get('format'))
|
||||
%>
|
||||
% if subsection.get('format') or 'special_exam' in subsection:
|
||||
% if subsection.get('format') or 'special_exam_info' in subsection:
|
||||
<span class="subtitle">
|
||||
% if 'special_exam' in subsection:
|
||||
## Display the proctored exam status icon and status message
|
||||
<span
|
||||
class="menu-icon icon fa ${subsection['special_exam'].get('suggested_icon', 'fa-pencil-square-o')} ${subsection['special_exam'].get('status', 'eligible')}"
|
||||
class="menu-icon icon fa ${subsection['special_exam_info'].get('suggested_icon', 'fa-pencil-square-o')} ${subsection['special_exam_info'].get('status', 'eligible')}"
|
||||
aria-hidden="true"
|
||||
></span>
|
||||
<span class="subtitle-name">
|
||||
${subsection['special_exam'].get('short_description', '')}
|
||||
${subsection['special_exam_info'].get('short_description', '')}
|
||||
</span>
|
||||
|
||||
## completed proctored exam statuses should not show the due date
|
||||
## since the exam has already been submitted by the user
|
||||
% if not subsection['special_exam'].get('in_completed_state', False):
|
||||
% if not subsection['special_exam_info'].get('in_completed_state', False):
|
||||
<span
|
||||
class="localized-datetime subtitle-name"
|
||||
data-datetime="${subsection.get('due')}"
|
||||
|
||||
@@ -47,6 +47,22 @@ class TestCourseOutlinePage(SharedModuleStoreTestCase):
|
||||
ItemFactory.create(category='vertical', parent_location=section2.location)
|
||||
course.last_accessed = None
|
||||
|
||||
cls.courses.append(course)
|
||||
|
||||
course = CourseFactory.create()
|
||||
with cls.store.bulk_operations(course.id):
|
||||
chapter = ItemFactory.create(category='chapter', parent_location=course.location)
|
||||
section = ItemFactory.create(
|
||||
category='sequential',
|
||||
parent_location=chapter.location,
|
||||
due=datetime.datetime.now(),
|
||||
graded=True,
|
||||
format='Homework',
|
||||
)
|
||||
ItemFactory.create(category='vertical', parent_location=section.location)
|
||||
course.last_accessed = section.url_name
|
||||
cls.courses.append(course)
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
"""Set up and enroll our fake user in the course."""
|
||||
@@ -70,14 +86,14 @@ class TestCourseOutlinePage(SharedModuleStoreTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
response_content = response.content.decode("utf-8")
|
||||
|
||||
if course.last_accessed is not None:
|
||||
self.assertIn('Resume Course', response_content)
|
||||
else:
|
||||
self.assertNotIn('Resume Course', response_content)
|
||||
self.assertIn('Resume Course', response_content)
|
||||
for chapter in course.children:
|
||||
self.assertIn(chapter.display_name, response_content)
|
||||
for section in chapter.children:
|
||||
self.assertIn(section.display_name, response_content)
|
||||
if section.graded:
|
||||
self.assertIn(section.due, response_content)
|
||||
self.assertIn(section.format, response_content)
|
||||
for vertical in section.children:
|
||||
self.assertNotIn(vertical.display_name, response_content)
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class CourseOutlineFragmentView(EdxFragmentView):
|
||||
course_usage_key,
|
||||
user=request.user,
|
||||
nav_depth=3,
|
||||
requested_fields=['children', 'display_name', 'type', 'due', 'graded', 'special_exam'],
|
||||
requested_fields=['children', 'display_name', 'type', 'due', 'graded', 'special_exam_info', 'format'],
|
||||
block_types_filter=['course', 'chapter', 'sequential']
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user