From e69fafce951359a06393bfb4d13883240bcf0265 Mon Sep 17 00:00:00 2001 From: DawoudSheraz Date: Fri, 23 Nov 2018 13:04:07 +0500 Subject: [PATCH] EDUCATOR-1714 due dates are not shown for Timed exams subsections on self-paced course on studio --- cms/templates/js/course-outline.underscore | 2 +- .../tests/studio/test_studio_outline.py | 62 +++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/cms/templates/js/course-outline.underscore b/cms/templates/js/course-outline.underscore index 13aadc7c2e..72b780ce4a 100644 --- a/cms/templates/js/course-outline.underscore +++ b/cms/templates/js/course-outline.underscore @@ -218,7 +218,7 @@ if (is_proctored_exam) { - <%- exam_value %> <%- exam_value %> - <% if (xblockInfo.get('due_date')) { %> + <% if (xblockInfo.get('due_date') && !course.get('self_paced')) { %> <%- gettext('Due:') %> <%- xblockInfo.get('due_date') %> <% } %>

diff --git a/common/test/acceptance/tests/studio/test_studio_outline.py b/common/test/acceptance/tests/studio/test_studio_outline.py index cfc839e37b..2f3eae33d8 100644 --- a/common/test/acceptance/tests/studio/test_studio_outline.py +++ b/common/test/acceptance/tests/studio/test_studio_outline.py @@ -1911,3 +1911,65 @@ class CourseStatusOutlineTest(CourseOutlineTest): self.course_outline_page.visit() self.course_outline_page.click_course_status_section_checklists_link() self.checklists.wait_for_page() + + +class InstructorPacedToSelfPacedOutlineTest(CourseOutlineTest): + """ + Test the course outline when pacing is changed from + instructor to self paced. + """ + def populate_course_fixture(self, course_fixture): + course_fixture.add_children( + XBlockFixtureDesc('chapter', SECTION_NAME).add_children( + XBlockFixtureDesc('sequential', SUBSECTION_NAME).add_children( + XBlockFixtureDesc('vertical', UNIT_NAME) + ) + ), + ) + self.course_fixture.add_course_details({ + 'start_date': datetime.now() + timedelta(days=1), + }) + self.course_fixture.add_advanced_settings({ + 'enable_timed_exams': { + 'value': True + } + }) + + def test_due_dates_not_shown(self): + """ + Scenario: Ensure that due dates for timed exams + are not displayed on the course outline page when switched to + self-paced mode from instructor-paced. + + Given an instructor paced course, add a due date for a subsection. + Change the course's pacing to self-paced. + Make the subsection a timed exam. + Make sure adding the timed exam doesn't display the due date. + """ + self.course_outline_page.visit() + section = self.course_outline_page.section(SECTION_NAME) + subsection = section.subsection(SUBSECTION_NAME) + + modal = subsection.edit() + modal.due_date = '5/14/2016' + modal.policy = 'Homework' + modal.save() + # Checking if the added due date saved + self.assertIn('May 14', subsection.due_date) + # Checking if grading policy added + self.assertEqual('Homework', subsection.policy) + + # Updating the course mode to self-paced + self.course_fixture.add_course_details({ + 'self_paced': True + }) + # Making the subsection a timed exam + self.course_outline_page.open_subsection_settings_dialog() + self.course_outline_page.select_advanced_tab() + self.course_outline_page.make_exam_timed() + + # configure call to actually update course with new settings + self.course_fixture.configure_course() + # Reloading page after the changes + self.course_outline_page.visit() + self.assertIsNone(subsection.due_date)