From 12e5226286c6534b670683b09090e2f0839323e4 Mon Sep 17 00:00:00 2001 From: Adam Palay Date: Thu, 30 Mar 2017 14:21:32 -0400 Subject: [PATCH 1/2] fix issue where orphaned openassessment blocks cause 500 errors on the instructor dashboard (TNL-6797) --- .../tests/views/test_instructor_dashboard.py | 25 ++++++++++++++----- .../instructor/views/instructor_dashboard.py | 8 +++++- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py index cf49ef2018..80dd7844b6 100644 --- a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py +++ b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py @@ -336,15 +336,28 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT response = self.client.get(self.url) self.assertNotIn(ora_section, response.content) - course = ItemFactory.create( - parent_location=self.course.location, - category="course", - display_name="Test course", - ) - ItemFactory.create(parent_location=course.location, category="openassessment") + ItemFactory.create(parent_location=self.course.location, category="openassessment") response = self.client.get(self.url) self.assertIn(ora_section, response.content) + def test_open_response_assessment_page_orphan(self): + """ + Tests that the open responses tab loads if the course contains an + orphaned openassessment block + """ + # create non-orphaned openassessment block + ItemFactory.create( + parent_location=self.course.location, + category="openassessment", + ) + # create orphan + self.store.create_item( + self.user.id, self.course.id, 'openassessment', "orphan" + ) + response = self.client.get(self.url) + # assert we don't get a 500 error + self.assertEqual(200, response.status_code) + @ddt.ddt class TestInstructorDashboardPerformance(ModuleStoreTestCase, LoginEnrollmentTestCase, XssTestMixin): diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 524565dffb..5aecf20927 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -192,7 +192,13 @@ def instructor_dashboard_2(request, course_id): if certs_enabled and access['admin']: sections.append(_section_certificates(course)) - openassessment_blocks = modulestore().get_items(course_key, qualifiers={'category': 'openassessment'}) + openassessment_blocks = modulestore().get_items( + course_key, qualifiers={'category': 'openassessment'} + ) + # filter out orphaned openassessment blocks + openassessment_blocks = [ + block for block in openassessment_blocks if block.parent is not None + ] if len(openassessment_blocks) > 0: sections.append(_section_open_response_assessment(request, course, openassessment_blocks, access)) From f94a726ce9770dbba783920077a10f00c4ba2d9f Mon Sep 17 00:00:00 2001 From: Carol Tong Date: Mon, 3 Apr 2017 13:19:28 -0400 Subject: [PATCH 2/2] Fix broken LMS Help Links --- .../util/tests/test_help_context_processor.py | 2 +- docs/lms_config.ini | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/djangoapps/util/tests/test_help_context_processor.py b/common/djangoapps/util/tests/test_help_context_processor.py index b4c2e26a5a..4ce771de2b 100644 --- a/common/djangoapps/util/tests/test_help_context_processor.py +++ b/common/djangoapps/util/tests/test_help_context_processor.py @@ -38,7 +38,7 @@ class HelpContextProcessorTest(TestCase): self.assertEqual(self._get_doc_url(), doc.format(doc_version())) # Provide a known page_token. - doc = "http://edx.readthedocs.io/projects/open-edx-learner-guide/en/{}/sfd_dashboard_profile/index.html" + doc = "http://edx.readthedocs.io/projects/open-edx-learner-guide/en/{}/SFD_dashboard_profile_SectionHead.html" self.assertEqual(self._get_doc_url('profile'), doc.format(doc_version())) # Use settings.DOC_LINK_BASE_URL to override default base_url. diff --git a/docs/lms_config.ini b/docs/lms_config.ini index 207fd46f3d..3e3ca4bdd9 100644 --- a/docs/lms_config.ini +++ b/docs/lms_config.ini @@ -20,19 +20,19 @@ instructor = SFD_instructor_dash_help.html course = index.html -profile = sfd_dashboard_profile/index.html +profile = SFD_dashboard_profile_SectionHead.html -dashboard = sfd_dashboard_profile/index.html +dashboard = SFD_dashboard_profile_SectionHead.html -courseinfo = SFD_introduction.html +courseinfo = SFD_start_course.html progress = SFD_check_progress.html -learneraccountsettings = sfd_dashboard_profile/SFD_dashboard_settings_profile.html#exploring-the-account-settings-page +learneraccountsettings = SFD_update_acct_settings.html -learnerdashboard = sfd_dashboard_profile/SFD_dashboard_settings_profile.html#exploring-the-dashboard +learnerdashboard = SFD_dashboard_profile_SectionHead.html -programs = SFD_enrolling.html#programs +programs = SFD_enrolling.html bookmarks = SFD_bookmarks.html