From c708a3824472dae766e1550dd8479185a3b75aa6 Mon Sep 17 00:00:00 2001 From: Leangseu Kim Date: Tue, 27 Jun 2023 15:09:00 -0400 Subject: [PATCH] feat: add open responses card to page and resources --- cms/envs/common.py | 1 + lms/djangoapps/courseware/plugins.py | 44 ++++++++++++++++++++++++++++ lms/envs/common.py | 1 + setup.py | 1 + 4 files changed, 47 insertions(+) diff --git a/cms/envs/common.py b/cms/envs/common.py index 41ef3f60c2ef..ff17f630f197 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -2706,6 +2706,7 @@ WIKI_HELP_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/course_assets/course_wiki.html" CUSTOM_PAGES_HELP_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/course_assets/pages.html#adding-custom-pages" COURSE_LIVE_HELP_URL = "https://edx.readthedocs.io/projects/edx-partner-course-staff/en/latest/course_assets/course_live.html" +OPEN_RESPONSES_HELP_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/course_assets/pages.html#enabling-the-flexible-peer-grade-for-ora" # keys for big blue button live provider COURSE_LIVE_GLOBAL_CREDENTIALS = {} diff --git a/lms/djangoapps/courseware/plugins.py b/lms/djangoapps/courseware/plugins.py index 3dcb2c4397d6..b3f9ba332502 100644 --- a/lms/djangoapps/courseware/plugins.py +++ b/lms/djangoapps/courseware/plugins.py @@ -267,3 +267,47 @@ def get_allowed_operations(cls, course_key: CourseKey, user: Optional[User] = No @staticmethod def legacy_link(course_key: CourseKey): return urls.reverse('tabs_handler', kwargs={'course_key_string': course_key}) + + +class OpenResponsesApp(CourseApp): + """ + Course App config for ORA app. + """ + + app_id = "open_responses" + name = _("Open Responses") + description = _("Turn on flexible peer grading for all open responses.") + documentation_links = { + "learn_more_configuration": settings.OPEN_RESPONSES_HELP_URL, + } + + @classmethod + def is_available(cls, course_key: CourseKey) -> bool: + """ + Open response is available for all courses. + """ + return True + + @classmethod + def is_enabled(cls, course_key: CourseKey) -> bool: + """ + Get open response enabled status from course overview model. + """ + return False + + @classmethod + def set_enabled(cls, course_key: CourseKey, enabled: bool, user: 'User') -> bool: + """ + Update open response enabled status in modulestore. + """ + return enabled + + @classmethod + def get_allowed_operations(cls, course_key: CourseKey, user: Optional[User] = None) -> Dict[str, bool]: + """ + Get allowed operations for open response app. + """ + return { + "enable": False, + "configure": True, + } diff --git a/lms/envs/common.py b/lms/envs/common.py index 16382b6175a8..90e73aac19dc 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -5211,6 +5211,7 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring WIKI_HELP_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/course_assets/course_wiki.html" CUSTOM_PAGES_HELP_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/course_assets/pages.html#adding-custom-pages" COURSE_BULK_EMAIL_HELP_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/manage_live_course/bulk_email.html" +OPEN_RESPONSES_HELP_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/course_assets/pages.html#enabling-the-flexible-peer-grade-for-ora" ################# Bulk Course Email Settings ################# # If set, recipients of bulk course email messages will be filtered based on the last_login date of their User account. diff --git a/setup.py b/setup.py index 1bad08d9582d..4e81336ea2d2 100644 --- a/setup.py +++ b/setup.py @@ -94,6 +94,7 @@ "wiki = lms.djangoapps.course_wiki.plugins.course_app:WikiCourseApp", "custom_pages = lms.djangoapps.courseware.plugins:CustomPagesCourseApp", "live = openedx.core.djangoapps.course_live.plugins:LiveCourseApp", + "open_responses = lms.djangoapps.courseware.plugins:OpenResponsesApp", ], "openedx.course_tool": [ "calendar_sync_toggle = openedx.features.calendar_sync.plugins:CalendarSyncToggleTool",