Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
e97283ae
Commit
e97283ae
authored
May 09, 2017
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix column alignment issue when Teams is disabled
parent
16e96365
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
lms/djangoapps/instructor_task/tasks_helper/grades.py
+6
-2
lms/djangoapps/instructor_task/tests/test_tasks_helper.py
+13
-6
No files found.
lms/djangoapps/instructor_task/tasks_helper/grades.py
View file @
e97283ae
...
@@ -134,7 +134,8 @@ class _CertificateBulkContext(object):
...
@@ -134,7 +134,8 @@ class _CertificateBulkContext(object):
class
_TeamBulkContext
(
object
):
class
_TeamBulkContext
(
object
):
def
__init__
(
self
,
context
,
users
):
def
__init__
(
self
,
context
,
users
):
if
context
.
teams_enabled
:
self
.
enabled
=
context
.
teams_enabled
if
self
.
enabled
:
self
.
teams_by_user
=
{
self
.
teams_by_user
=
{
membership
.
user
.
id
:
membership
.
team
.
name
membership
.
user
.
id
:
membership
.
team
.
name
for
membership
in
for
membership
in
...
@@ -326,7 +327,10 @@ class CourseGradeReport(object):
...
@@ -326,7 +327,10 @@ class CourseGradeReport(object):
"""
"""
Returns a list of names of teams in which the given user belongs.
Returns a list of names of teams in which the given user belongs.
"""
"""
return
[
bulk_teams
.
teams_by_user
.
get
(
user
.
id
,
''
)]
team_names
=
[]
if
bulk_teams
.
enabled
:
team_names
=
[
bulk_teams
.
teams_by_user
.
get
(
user
.
id
,
''
)]
return
team_names
def
_user_verification_mode
(
self
,
user
,
context
,
bulk_enrollments
):
def
_user_verification_mode
(
self
,
user
,
context
,
bulk_enrollments
):
"""
"""
...
...
lms/djangoapps/instructor_task/tests/test_tasks_helper.py
View file @
e97283ae
...
@@ -96,10 +96,13 @@ class InstructorGradeReportTestCase(TestReportMixin, InstructorTaskCourseTestCas
...
@@ -96,10 +96,13 @@ class InstructorGradeReportTestCase(TestReportMixin, InstructorTaskCourseTestCas
report_store
=
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
report_store
=
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
report_csv_filename
=
report_store
.
links_for
(
course_id
)[
0
][
0
]
report_csv_filename
=
report_store
.
links_for
(
course_id
)[
0
][
0
]
report_path
=
report_store
.
path_to
(
course_id
,
report_csv_filename
)
report_path
=
report_store
.
path_to
(
course_id
,
report_csv_filename
)
found_user
=
False
with
report_store
.
storage
.
open
(
report_path
)
as
csv_file
:
with
report_store
.
storage
.
open
(
report_path
)
as
csv_file
:
for
row
in
unicodecsv
.
DictReader
(
csv_file
):
for
row
in
unicodecsv
.
DictReader
(
csv_file
):
if
row
.
get
(
'
u
sername'
)
==
username
:
if
row
.
get
(
'
U
sername'
)
==
username
:
self
.
assertEqual
(
row
[
column_header
],
expected_cell_content
)
self
.
assertEqual
(
row
[
column_header
],
expected_cell_content
)
found_user
=
True
self
.
assertTrue
(
found_user
)
@ddt.ddt
@ddt.ddt
...
@@ -301,7 +304,7 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase):
...
@@ -301,7 +304,7 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase):
user_b
.
username
,
user_b
.
username
,
course
.
id
,
course
.
id
,
cohort_name_header
,
cohort_name_header
,
u'
Default Group
'
,
u''
,
)
)
@patch
(
'lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'
)
@patch
(
'lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'
)
...
@@ -1229,13 +1232,11 @@ class TestTeamStudentReport(TestReportMixin, InstructorTaskCourseTestCase):
...
@@ -1229,13 +1232,11 @@ class TestTeamStudentReport(TestReportMixin, InstructorTaskCourseTestCase):
""" Run the upload_students_csv task and verify that the correct team was added to the CSV. """
""" Run the upload_students_csv task and verify that the correct team was added to the CSV. """
current_task
=
Mock
()
current_task
=
Mock
()
current_task
.
update_state
=
Mock
()
current_task
.
update_state
=
Mock
()
task_input
=
{
task_input
=
[
'features'
:
[
'id'
,
'username'
,
'name'
,
'email'
,
'language'
,
'location'
,
'id'
,
'username'
,
'name'
,
'email'
,
'language'
,
'location'
,
'year_of_birth'
,
'gender'
,
'level_of_education'
,
'mailing_address'
,
'year_of_birth'
,
'gender'
,
'level_of_education'
,
'mailing_address'
,
'goals'
,
'team'
'goals'
,
'team'
]
]
}
with
patch
(
'lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'
)
as
mock_current_task
:
with
patch
(
'lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'
)
as
mock_current_task
:
mock_current_task
.
return_value
=
current_task
mock_current_task
.
return_value
=
current_task
result
=
upload_students_csv
(
None
,
None
,
self
.
course
.
id
,
task_input
,
'calculated'
)
result
=
upload_students_csv
(
None
,
None
,
self
.
course
.
id
,
task_input
,
'calculated'
)
...
@@ -1243,10 +1244,13 @@ class TestTeamStudentReport(TestReportMixin, InstructorTaskCourseTestCase):
...
@@ -1243,10 +1244,13 @@ class TestTeamStudentReport(TestReportMixin, InstructorTaskCourseTestCase):
report_store
=
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
report_store
=
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
report_csv_filename
=
report_store
.
links_for
(
self
.
course
.
id
)[
0
][
0
]
report_csv_filename
=
report_store
.
links_for
(
self
.
course
.
id
)[
0
][
0
]
report_path
=
report_store
.
path_to
(
self
.
course
.
id
,
report_csv_filename
)
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
:
with
report_store
.
storage
.
open
(
report_path
)
as
csv_file
:
for
row
in
unicodecsv
.
DictReader
(
csv_file
):
for
row
in
unicodecsv
.
DictReader
(
csv_file
):
if
row
.
get
(
'username'
)
==
username
:
if
row
.
get
(
'username'
)
==
username
:
self
.
assertEqual
(
row
[
'team'
],
expected_team
)
self
.
assertEqual
(
row
[
'team'
],
expected_team
)
found_user
=
True
self
.
assertTrue
(
found_user
)
def
test_team_column_no_teams
(
self
):
def
test_team_column_no_teams
(
self
):
self
.
_generate_and_verify_teams_column
(
self
.
student1
.
username
,
UNAVAILABLE
)
self
.
_generate_and_verify_teams_column
(
self
.
student1
.
username
,
UNAVAILABLE
)
...
@@ -1698,11 +1702,14 @@ class TestGradeReportEnrollmentAndCertificateInfo(TestReportMixin, InstructorTas
...
@@ -1698,11 +1702,14 @@ class TestGradeReportEnrollmentAndCertificateInfo(TestReportMixin, InstructorTas
report_store
=
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
report_store
=
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
report_csv_filename
=
report_store
.
links_for
(
self
.
course
.
id
)[
0
][
0
]
report_csv_filename
=
report_store
.
links_for
(
self
.
course
.
id
)[
0
][
0
]
report_path
=
report_store
.
path_to
(
self
.
course
.
id
,
report_csv_filename
)
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
:
with
report_store
.
storage
.
open
(
report_path
)
as
csv_file
:
for
row
in
unicodecsv
.
DictReader
(
csv_file
):
for
row
in
unicodecsv
.
DictReader
(
csv_file
):
if
row
.
get
(
'
u
sername'
)
==
username
:
if
row
.
get
(
'
U
sername'
)
==
username
:
csv_row_data
=
[
row
[
column
]
for
column
in
self
.
columns_to_check
]
csv_row_data
=
[
row
[
column
]
for
column
in
self
.
columns_to_check
]
self
.
assertEqual
(
csv_row_data
,
expected_data
)
self
.
assertEqual
(
csv_row_data
,
expected_data
)
found_user
=
True
self
.
assertTrue
(
found_user
)
def
_create_user_data
(
self
,
def
_create_user_data
(
self
,
user_enroll_mode
,
user_enroll_mode
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment