Commit 9bedb066 by sanfordstudent Committed by GitHub

Merge pull request #15084 from edx/neem/grade_report_revert

Revert "Fix column alignment issue when Teams is disabled"
parents 1bbde007 b6b70401
......@@ -134,8 +134,7 @@ class _CertificateBulkContext(object):
class _TeamBulkContext(object):
def __init__(self, context, users):
self.enabled = context.teams_enabled
if self.enabled:
if context.teams_enabled:
self.teams_by_user = {
membership.user.id: membership.team.name
for membership in
......@@ -327,10 +326,7 @@ class CourseGradeReport(object):
"""
Returns a list of names of teams in which the given user belongs.
"""
team_names = []
if bulk_teams.enabled:
team_names = [bulk_teams.teams_by_user.get(user.id, '')]
return team_names
return [bulk_teams.teams_by_user.get(user.id, '')]
def _user_verification_mode(self, user, context, bulk_enrollments):
"""
......
......@@ -96,13 +96,10 @@ class InstructorGradeReportTestCase(TestReportMixin, InstructorTaskCourseTestCas
report_store = ReportStore.from_config(config_name='GRADES_DOWNLOAD')
report_csv_filename = report_store.links_for(course_id)[0][0]
report_path = report_store.path_to(course_id, report_csv_filename)
found_user = False
with report_store.storage.open(report_path) as csv_file:
for row in unicodecsv.DictReader(csv_file):
if row.get('Username') == username:
if row.get('username') == username:
self.assertEqual(row[column_header], expected_cell_content)
found_user = True
self.assertTrue(found_user)
@ddt.ddt
......@@ -304,7 +301,7 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase):
user_b.username,
course.id,
cohort_name_header,
u'',
u'Default Group',
)
@patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task')
......@@ -1232,11 +1229,13 @@ class TestTeamStudentReport(TestReportMixin, InstructorTaskCourseTestCase):
""" Run the upload_students_csv task and verify that the correct team was added to the CSV. """
current_task = Mock()
current_task.update_state = Mock()
task_input = [
'id', 'username', 'name', 'email', 'language', 'location',
'year_of_birth', 'gender', 'level_of_education', 'mailing_address',
'goals', 'team'
]
task_input = {
'features': [
'id', 'username', 'name', 'email', 'language', 'location',
'year_of_birth', 'gender', 'level_of_education', 'mailing_address',
'goals', 'team'
]
}
with patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task') as mock_current_task:
mock_current_task.return_value = current_task
result = upload_students_csv(None, None, self.course.id, task_input, 'calculated')
......@@ -1244,13 +1243,10 @@ class TestTeamStudentReport(TestReportMixin, InstructorTaskCourseTestCase):
report_store = ReportStore.from_config(config_name='GRADES_DOWNLOAD')
report_csv_filename = report_store.links_for(self.course.id)[0][0]
report_path = report_store.path_to(self.course.id, report_csv_filename)
found_user = False
with report_store.storage.open(report_path) as csv_file:
for row in unicodecsv.DictReader(csv_file):
if row.get('username') == username:
self.assertEqual(row['team'], expected_team)
found_user = True
self.assertTrue(found_user)
def test_team_column_no_teams(self):
self._generate_and_verify_teams_column(self.student1.username, UNAVAILABLE)
......@@ -1702,14 +1698,11 @@ class TestGradeReportEnrollmentAndCertificateInfo(TestReportMixin, InstructorTas
report_store = ReportStore.from_config(config_name='GRADES_DOWNLOAD')
report_csv_filename = report_store.links_for(self.course.id)[0][0]
report_path = report_store.path_to(self.course.id, report_csv_filename)
found_user = False
with report_store.storage.open(report_path) as csv_file:
for row in unicodecsv.DictReader(csv_file):
if row.get('Username') == username:
if row.get('username') == username:
csv_row_data = [row[column] for column in self.columns_to_check]
self.assertEqual(csv_row_data, expected_data)
found_user = True
self.assertTrue(found_user)
def _create_user_data(self,
user_enroll_mode,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment