From d86aa824c1e32bc5543759ef5990ebe8dfd5e4ce Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Tue, 6 Jul 2021 11:34:40 -0400 Subject: [PATCH] revert: feat: add & expose courseware.use_learning_sequences_api flag (#28054) The learning_sequences.use_for_outlines flag was recently added, intended to serve the same purpose as courseware.use_learning_seuqences_api. We do not need both flags. Furthermore, exposing either flag in the Courseware Metadata API is neither necessary nor helpful, since the easiest and quickest way for the Learning MFE to see if the Learning Sequences API is enabled is to hit it, and fall back to a different API if a 403 is returned. This reverts commit 78f1e2b3bd8d109e8cc48fb269bf6075a0837071. TNL-8330 --- lms/djangoapps/courseware/toggles.py | 17 ----------------- .../djangoapps/courseware_api/serializers.py | 1 - .../courseware_api/tests/test_views.py | 12 ------------ .../core/djangoapps/courseware_api/views.py | 18 ------------------ 4 files changed, 48 deletions(-) diff --git a/lms/djangoapps/courseware/toggles.py b/lms/djangoapps/courseware/toggles.py index 94a07b18b5..9007b49f85 100644 --- a/lms/djangoapps/courseware/toggles.py +++ b/lms/djangoapps/courseware/toggles.py @@ -25,23 +25,6 @@ COURSEWARE_USE_LEGACY_FRONTEND = CourseWaffleFlag( WAFFLE_FLAG_NAMESPACE, 'use_legacy_frontend', __name__ ) -# .. toggle_name: courseware.use_learning_sequences_api -# .. toggle_implementation: CourseWaffleFlag -# .. toggle_default: False -# .. toggle_description: When enbled, frontend-app-learning's courseware pages should use the -# new Learning Sequences API (from ``openedx.core.djangoapps.content.learning_sequences``) -# instead of the Course Blocks API (from ``lms.djangoapps.course_api.blocks``) -# in order to load course structure data. -# .. toggle_warnings: As of 2021-06-25, the frontend-app-learning changes necessary to honor this -# flag's value have not yet been implemented. We expect that they will be implemented in -# the coming weeks. -# .. toggle_use_cases: temporary -# .. toggle_creation_date: 2021-06-25 -# .. toggle_target_removal_date: 2021-09-01 -COURSEWARE_USE_LEARNING_SEQUENCES_API = CourseWaffleFlag( - WAFFLE_FLAG_NAMESPACE, 'use_learning_sequences_api', __name__ -) - # .. toggle_name: courseware.microfrontend_course_team_preview # .. toggle_implementation: CourseWaffleFlag # .. toggle_default: False diff --git a/openedx/core/djangoapps/courseware_api/serializers.py b/openedx/core/djangoapps/courseware_api/serializers.py index 41e60222c3..68b7836eb1 100644 --- a/openedx/core/djangoapps/courseware_api/serializers.py +++ b/openedx/core/djangoapps/courseware_api/serializers.py @@ -116,7 +116,6 @@ class CourseInfoSerializer(serializers.Serializer): # pylint: disable=abstract- verify_identity_url = AbsoluteURLField() verification_status = serializers.CharField() linkedin_add_to_profile_url = serializers.URLField() - is_learning_sequences_api_enabled = serializers.BooleanField() is_mfe_special_exams_enabled = serializers.BooleanField() is_mfe_proctored_exams_enabled = serializers.BooleanField() user_needs_integrity_signature = serializers.BooleanField() diff --git a/openedx/core/djangoapps/courseware_api/tests/test_views.py b/openedx/core/djangoapps/courseware_api/tests/test_views.py index 7492b3602f..c9dd69d040 100644 --- a/openedx/core/djangoapps/courseware_api/tests/test_views.py +++ b/openedx/core/djangoapps/courseware_api/tests/test_views.py @@ -28,7 +28,6 @@ from lms.djangoapps.courseware.toggles import ( COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES_STREAK_CELEBRATION, COURSEWARE_MICROFRONTEND_SPECIAL_EXAMS, COURSEWARE_MICROFRONTEND_PROCTORED_EXAMS, - COURSEWARE_USE_LEARNING_SEQUENCES_API, ) from lms.djangoapps.experiments.testutils import override_experiment_waffle_flag from lms.djangoapps.experiments.utils import STREAK_DISCOUNT_EXPERIMENT_FLAG @@ -295,17 +294,6 @@ class CourseApiTestViews(BaseCoursewareTests, MasqueradeMixin): else: assert not response.data['can_load_courseware']['has_access'] - @ddt.data(True, False) - def test_is_learning_sequences_api_enabled(self, enable_new_api): - """ - Test that the Courseware API exposes the Learning Sequences API flag. - """ - with override_waffle_flag(COURSEWARE_USE_LEARNING_SEQUENCES_API, active=enable_new_api): - response = self.client.get(self.url) - assert response.status_code == 200 - courseware_data = response.json() - assert courseware_data['is_learning_sequences_api_enabled'] is enable_new_api - def test_streak_data_in_response(self): """ Test that metadata endpoint returns data for the streak celebration """ CourseEnrollment.enroll(self.user, self.course.id, 'audit') diff --git a/openedx/core/djangoapps/courseware_api/views.py b/openedx/core/djangoapps/courseware_api/views.py index 1b104b830b..55f71ba481 100644 --- a/openedx/core/djangoapps/courseware_api/views.py +++ b/openedx/core/djangoapps/courseware_api/views.py @@ -38,7 +38,6 @@ from lms.djangoapps.courseware.toggles import ( course_exit_page_is_active, mfe_special_exams_is_active, mfe_proctored_exams_is_active, - COURSEWARE_USE_LEARNING_SEQUENCES_API, ) from lms.djangoapps.courseware.views.views import get_cert_data from lms.djangoapps.grades.api import CourseGradeFactory @@ -121,23 +120,6 @@ class CoursewareMeta: is_course_staff=self.original_user_is_staff ) - @property - def is_learning_sequences_api_enabled(self): - """ - Should the Learning Sequences API be used to load course structure data? - - Courseware views in frontend-app-learning need to load course structure data - from the backend to display feaures like breadcrumbs, the smart "Next" - button, etc. This has been done so far using the Course Blocks API. - - Over the next few weeks (starting 2021-06-25), we will be incrementally - transitioning said views to instead use the Learning Sequences API, - which we expect to be significantly faster. Once the transition is in - progress, this function will surface to frontend-app-learning whether - the old Course Blocks API or Learning Sequences API should be used. - """ - return COURSEWARE_USE_LEARNING_SEQUENCES_API.is_enabled(self.course_key) - @property def is_mfe_special_exams_enabled(self): return settings.FEATURES.get('ENABLE_SPECIAL_EXAMS', False) and mfe_special_exams_is_active(self.course_key)