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
bfa8349e
Commit
bfa8349e
authored
Nov 21, 2014
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up Datadump section on legacy dashboard
parent
5aeb412b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
105 deletions
+6
-105
lms/djangoapps/instructor/tests/test_legacy_anon_csv.py
+0
-67
lms/djangoapps/instructor/views/legacy.py
+0
-34
lms/templates/courseware/legacy_instructor_dashboard.html
+6
-4
No files found.
lms/djangoapps/instructor/tests/test_legacy_anon_csv.py
deleted
100644 → 0
View file @
5aeb412b
"""
Unit tests for instructor dashboard
Based on (and depends on) unit tests for courseware.
Notes for running by hand:
./manage.py lms --settings test test lms/djangoapps/instructor
"""
from
django.test.utils
import
override_settings
# Need access to internal func to put users in the right group
from
django.contrib.auth.models
import
User
from
django.core.urlresolvers
import
reverse
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
xmodule.modulestore.tests.django_utils
import
TEST_DATA_MOCK_MODULESTORE
import
instructor.views.legacy
from
student.roles
import
CourseStaffRole
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
mock
import
Mock
,
patch
@override_settings
(
MODULESTORE
=
TEST_DATA_MOCK_MODULESTORE
)
class
TestInstructorDashboardAnonCSV
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
'''
Check for download of csv
'''
# Note -- I copied this setUp from a similar test
def
setUp
(
self
):
# clear_existing_modulestores()
self
.
toy
=
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'toy'
,
display_name
=
'2012_Fall'
)
# Create two accounts
self
.
student
=
'view@test.com'
self
.
instructor
=
'view2@test.com'
self
.
password
=
'foo'
self
.
create_account
(
'u1'
,
self
.
student
,
self
.
password
)
self
.
create_account
(
'u2'
,
self
.
instructor
,
self
.
password
)
self
.
activate_user
(
self
.
student
)
self
.
activate_user
(
self
.
instructor
)
CourseStaffRole
(
self
.
toy
.
id
)
.
add_users
(
User
.
objects
.
get
(
email
=
self
.
instructor
))
self
.
logout
()
self
.
login
(
self
.
instructor
,
self
.
password
)
self
.
enroll
(
self
.
toy
)
@patch.object
(
instructor
.
views
.
legacy
,
'anonymous_id_for_user'
,
Mock
(
return_value
=
'42'
))
@patch.object
(
instructor
.
views
.
legacy
,
'unique_id_for_user'
,
Mock
(
return_value
=
'41'
))
def
test_download_anon_csv
(
self
):
course
=
self
.
toy
url
=
reverse
(
'instructor_dashboard_legacy'
,
kwargs
=
{
'course_id'
:
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
post
(
url
,
{
'action'
:
'Download CSV of all student anonymized IDs'
})
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/csv'
)
body
=
response
.
content
.
replace
(
'
\r
'
,
''
)
self
.
assertEqual
(
body
,
(
'"User ID","Anonymized User ID","Course Specific Anonymized User ID"'
'
\n
"2","41","42"
\n
'
)
)
lms/djangoapps/instructor/views/legacy.py
View file @
bfa8349e
...
@@ -315,31 +315,6 @@ def instructor_dashboard(request, course_id):
...
@@ -315,31 +315,6 @@ def instructor_dashboard(request, course_id):
#----------------------------------------
#----------------------------------------
# DataDump
# DataDump
elif
'Download CSV of all student profile data'
in
action
:
enrolled_students
=
User
.
objects
.
filter
(
courseenrollment__course_id
=
course_key
,
courseenrollment__is_active
=
1
,
)
.
order_by
(
'username'
)
.
select_related
(
"profile"
)
profkeys
=
[
'name'
,
'language'
,
'location'
,
'year_of_birth'
,
'gender'
,
'level_of_education'
,
'mailing_address'
,
'goals'
]
datatable
=
{
'header'
:
[
'username'
,
'email'
]
+
profkeys
}
def
getdat
(
user
):
"""
Return a list of profile data for the given user.
"""
profile
=
user
.
profile
return
[
user
.
username
,
user
.
email
]
+
[
getattr
(
profile
,
xkey
,
''
)
for
xkey
in
profkeys
]
datatable
[
'data'
]
=
[
getdat
(
u
)
for
u
in
enrolled_students
]
datatable
[
'title'
]
=
_
(
'Student profile data for course {course_id}'
)
.
format
(
course_id
=
course_key
.
to_deprecated_string
()
)
return
return_csv
(
'profiledata_{course_id}.csv'
.
format
(
course_id
=
course_key
.
to_deprecated_string
()),
datatable
)
elif
'Download CSV of all responses to problem'
in
action
:
elif
'Download CSV of all responses to problem'
in
action
:
problem_to_dump
=
request
.
POST
.
get
(
'problem_to_dump'
,
''
)
problem_to_dump
=
request
.
POST
.
get
(
'problem_to_dump'
,
''
)
...
@@ -366,15 +341,6 @@ def instructor_dashboard(request, course_id):
...
@@ -366,15 +341,6 @@ def instructor_dashboard(request, course_id):
datatable
[
'title'
]
=
_
(
'Student state for problem {problem}'
)
.
format
(
problem
=
problem_to_dump
)
datatable
[
'title'
]
=
_
(
'Student state for problem {problem}'
)
.
format
(
problem
=
problem_to_dump
)
return
return_csv
(
'student_state_from_{problem}.csv'
.
format
(
problem
=
problem_to_dump
),
datatable
)
return
return_csv
(
'student_state_from_{problem}.csv'
.
format
(
problem
=
problem_to_dump
),
datatable
)
elif
'Download CSV of all student anonymized IDs'
in
action
:
students
=
User
.
objects
.
filter
(
courseenrollment__course_id
=
course_key
,
)
.
order_by
(
'id'
)
datatable
=
{
'header'
:
[
'User ID'
,
'Anonymized User ID'
,
'Course Specific Anonymized User ID'
]}
datatable
[
'data'
]
=
[[
s
.
id
,
unique_id_for_user
(
s
,
save
=
False
),
anonymous_id_for_user
(
s
,
course_key
,
save
=
False
)]
for
s
in
students
]
return
return_csv
(
course_key
.
to_deprecated_string
()
.
replace
(
'/'
,
'-'
)
+
'-anon-ids.csv'
,
datatable
)
#----------------------------------------
#----------------------------------------
# enrollment
# enrollment
...
...
lms/templates/courseware/legacy_instructor_dashboard.html
View file @
bfa8349e
...
@@ -369,15 +369,17 @@ function goto( mode)
...
@@ -369,15 +369,17 @@ function goto( mode)
%if modeflag.get('Data'):
%if modeflag.get('Data'):
<hr
width=
"40%"
style=
"align:left"
>
<hr
width=
"40%"
style=
"align:left"
>
<p>
<p
class=
"deprecated"
>
<input
type=
"submit"
name=
"action"
value=
"Download CSV of all student profile data"
>
${_("To download student profile data, please visit the 'Data Download' section of the instructor dashboard.")}
</p>
</p>
<p>
${_("Problem urlname:")}
<p>
${_("Problem urlname:")}
<input
type=
"text"
name=
"problem_to_dump"
size=
"40"
>
<input
type=
"text"
name=
"problem_to_dump"
size=
"40"
>
<input
type=
"submit"
name=
"action"
value=
"Download CSV of all responses to problem"
>
<input
type=
"submit"
name=
"action"
value=
"Download CSV of all responses to problem"
>
</p>
</p>
<p>
<input
type=
"submit"
name=
"action"
value=
"Download CSV of all student anonymized IDs"
>
<p
class=
"deprecated"
>
${_("To download student anonymized IDs, please visit the 'Data Download' section of the instructor dashboard.")}
</p>
</p>
<hr
width=
"40%"
style=
"align:left"
>
<hr
width=
"40%"
style=
"align:left"
>
%endif
%endif
...
...
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