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
373f8e82
Commit
373f8e82
authored
Jan 15, 2015
by
Waheed Ahmed
Committed by
Adam Palay
Jan 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unicode error in CSV grade report generation.
TNL-1196
parent
dca3b0fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
lms/djangoapps/instructor_task/tasks_helper.py
+1
-2
lms/djangoapps/instructor_task/tests/test_tasks_helper.py
+17
-0
No files found.
lms/djangoapps/instructor_task/tasks_helper.py
View file @
373f8e82
...
...
@@ -572,8 +572,7 @@ def upload_grades_csv(_xmodule_instance_args, _entry_id, course_id, _task_input,
# We were able to successfully grade this student for this course.
task_progress
.
succeeded
+=
1
if
not
header
:
# Encode the header row in utf-8 encoding in case there are unicode characters
header
=
[
section
[
'label'
]
.
encode
(
'utf-8'
)
for
section
in
gradeset
[
u'section_breakdown'
]]
header
=
[
section
[
'label'
]
for
section
in
gradeset
[
u'section_breakdown'
]]
rows
.
append
(
[
"id"
,
"email"
,
"username"
,
"grade"
]
+
header
+
cohorts_header
+
group_configs_header
)
...
...
lms/djangoapps/instructor_task/tests/test_tasks_helper.py
View file @
373f8e82
...
...
@@ -139,6 +139,23 @@ class TestInstructorGradeReport(TestReportMixin, InstructorTaskCourseTestCase):
_groups
=
[
group
.
name
for
group
in
self
.
course
.
user_partitions
[
0
]
.
groups
]
self
.
assertEqual
(
_groups
,
user_groups
)
@patch
(
'instructor_task.tasks_helper._get_current_task'
)
@patch
(
'instructor_task.tasks_helper.iterate_grades_for'
)
def
test_unicode_in_csv_header
(
self
,
mock_iterate_grades_for
,
_mock_current_task
):
"""
Tests that CSV grade report works if unicode in headers.
"""
# mock a response from `iterate_grades_for`
mock_iterate_grades_for
.
return_value
=
[
(
self
.
create_student
(
'username'
,
'student@example.com'
),
{
'section_breakdown'
:
[{
'label'
:
u'
\u8282\u540e\u9898
01'
}],
'percent'
:
0
},
'Cannot grade student'
)
]
result
=
upload_grades_csv
(
None
,
None
,
self
.
course
.
id
,
None
,
'graded'
)
self
.
assertDictContainsSubset
({
'attempted'
:
1
,
'succeeded'
:
1
,
'failed'
:
0
},
result
)
@ddt.ddt
class
TestStudentReport
(
TestReportMixin
,
InstructorTaskCourseTestCase
):
...
...
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