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.
This commit is contained in:
alangsto
2021-11-24 11:41:20 -05:00
committed by GitHub
parent 52bb0104f9
commit a1b967a2fb
2 changed files with 33 additions and 0 deletions

View File

@@ -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)})

View File

@@ -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')