From a1b967a2fb0b01a36c465116700106bf6143df34 Mon Sep 17 00:00:00 2001 From: alangsto <46360176+alangsto@users.noreply.github.com> Date: Wed, 24 Nov 2021 11:41:20 -0500 Subject: [PATCH] feat: remove verification status from profile data report (#29428) The verification status should be removed from the student profile data report if the integrity signature toggle has been enabled. --- lms/djangoapps/instructor/tests/test_api.py | 27 +++++++++++++++++++++ lms/djangoapps/instructor/views/api.py | 6 +++++ 2 files changed, 33 insertions(+) diff --git a/lms/djangoapps/instructor/tests/test_api.py b/lms/djangoapps/instructor/tests/test_api.py index 044f84ff66..bd1de854c1 100644 --- a/lms/djangoapps/instructor/tests/test_api.py +++ b/lms/djangoapps/instructor/tests/test_api.py @@ -2806,6 +2806,33 @@ class TestInstructorAPILevelsDataDump(SharedModuleStoreTestCase, LoginEnrollment response = self.client.post(url, {}) self.assertContains(response, success_status) + @ddt.data( + True, + False + ) + @patch('lms.djangoapps.instructor.views.api.is_integrity_signature_enabled') + @valid_problem_location + def test_idv_retirement_student_features_report(self, toggle_value, mock_toggle): + mock_toggle.return_value = toggle_value + kwargs = {'course_id': str(self.course.id)} + kwargs.update({'csv': '/csv'}) + url = reverse('get_students_features', kwargs=kwargs) + success_status = 'The enrolled learner profile report is being created.' + with patch('lms.djangoapps.instructor_task.api.submit_calculate_students_features_csv') as mock_task_endpoint: + CourseFinanceAdminRole(self.course.id).add_users(self.instructor) + response = self.client.post(url, {}) + self.assertContains(response, success_status) + + # assert that if the integrity signature is enabled, the verification + # status is not included as a query feature + args = mock_task_endpoint.call_args.args + self.assertEqual(len(args), 3) + query_features = args[2] + if not toggle_value: + self.assertIn('verification_status', query_features) + else: + self.assertNotIn('verification_status', query_features) + def test_get_ora2_responses_success(self): url = reverse('export_ora2_data', kwargs={'course_id': str(self.course.id)}) diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index 6385adf00a..248a8dd5cc 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -101,6 +101,7 @@ from lms.djangoapps.instructor_analytics import basic as instructor_analytics_ba from lms.djangoapps.instructor_task import api as task_api from lms.djangoapps.instructor_task.api_helper import AlreadyRunningError, QueueConnectionError from lms.djangoapps.instructor_task.models import ReportStore +from openedx.core.djangoapps.agreements.toggles import is_integrity_signature_enabled from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort, is_course_cohorted from openedx.core.djangoapps.course_groups.models import CourseUserGroup @@ -1458,6 +1459,11 @@ def get_students_features(request, course_id, csv=False): # pylint: disable=red query_features.append('team') query_features_names['team'] = _('Team') + if is_integrity_signature_enabled(course_key): + if 'verification_status' in query_features: + query_features.remove('verification_status') + query_features_names.pop('verification_status') + # For compatibility reasons, city and country should always appear last. query_features.append('city') query_features_names['city'] = _('City')