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
fd20496a
Commit
fd20496a
authored
Jan 16, 2013
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1280 from MITx/feature/jth/attempts_reset
Added 2 new instructor tools
parents
ad68177e
f7f563db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
3 deletions
+84
-3
lms/djangoapps/instructor/views.py
+76
-0
lms/templates/courseware/instructor_dashboard.html
+8
-3
No files found.
lms/djangoapps/instructor/views.py
View file @
fd20496a
...
@@ -8,6 +8,7 @@ import logging
...
@@ -8,6 +8,7 @@ import logging
import
os
import
os
import
requests
import
requests
import
urllib
import
urllib
import
json
from
StringIO
import
StringIO
from
StringIO
import
StringIO
...
@@ -30,6 +31,7 @@ from django_comment_client.models import (Role,
...
@@ -30,6 +31,7 @@ from django_comment_client.models import (Role,
from
django_comment_client.utils
import
has_forum_access
from
django_comment_client.utils
import
has_forum_access
from
psychometrics
import
psychoanalyze
from
psychometrics
import
psychoanalyze
from
student.models
import
CourseEnrollment
,
CourseEnrollmentAllowed
from
student.models
import
CourseEnrollment
,
CourseEnrollmentAllowed
from
courseware.models
import
StudentModule
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
...
@@ -186,6 +188,80 @@ def instructor_dashboard(request, course_id):
...
@@ -186,6 +188,80 @@ def instructor_dashboard(request, course_id):
track
.
views
.
server_track
(
request
,
'dump-answer-dist-csv'
,
{},
page
=
'idashboard'
)
track
.
views
.
server_track
(
request
,
'dump-answer-dist-csv'
,
{},
page
=
'idashboard'
)
return
return_csv
(
'answer_dist_{0}.csv'
.
format
(
course_id
),
get_answers_distribution
(
request
,
course_id
))
return
return_csv
(
'answer_dist_{0}.csv'
.
format
(
course_id
),
get_answers_distribution
(
request
,
course_id
))
elif
"Reset student's attempts"
in
action
:
# get the form data
unique_student_identifier
=
request
.
POST
.
get
(
'unique_student_identifier'
,
''
)
problem_to_reset
=
request
.
POST
.
get
(
'problem_to_reset'
,
''
)
if
problem_to_reset
[
-
4
:]
==
".xml"
:
problem_to_reset
=
problem_to_reset
[:
-
4
]
# try to uniquely id student by email address or username
try
:
if
"@"
in
unique_student_identifier
:
student_to_reset
=
User
.
objects
.
get
(
email
=
unique_student_identifier
)
else
:
student_to_reset
=
User
.
objects
.
get
(
username
=
unique_student_identifier
)
msg
+=
"Found a single student to reset. "
except
:
student_to_reset
=
None
msg
+=
"<font color='red'>Couldn't find student with that email or username. </font>"
if
student_to_reset
is
not
None
:
# find the module in question
try
:
(
org
,
course_name
,
run
)
=
course_id
.
split
(
"/"
)
module_state_key
=
"i4x://"
+
org
+
"/"
+
course_name
+
"/problem/"
+
problem_to_reset
module_to_reset
=
StudentModule
.
objects
.
get
(
student_id
=
student_to_reset
.
id
,
course_id
=
course_id
,
module_state_key
=
module_state_key
)
msg
+=
"Found module to reset. "
except
Exception
as
e
:
msg
+=
"<font color='red'>Couldn't find module with that urlname. </font>"
# modify the problem's state
try
:
# load the state json
problem_state
=
json
.
loads
(
module_to_reset
.
state
)
old_number_of_attempts
=
problem_state
[
"attempts"
]
problem_state
[
"attempts"
]
=
0
# save
module_to_reset
.
state
=
json
.
dumps
(
problem_state
)
module_to_reset
.
save
()
track
.
views
.
server_track
(
request
,
'{instructor} reset attempts from {old_attempts} to 0 for {student} on problem {problem} in {course}'
.
format
(
old_attempts
=
old_number_of_attempts
,
student
=
student_to_reset
,
problem
=
module_to_reset
.
module_state_key
,
instructor
=
request
.
user
,
course
=
course_id
),
{},
page
=
'idashboard'
)
msg
+=
"<font color='green'>Module state successfully reset!</font>"
except
:
msg
+=
"<font color='red'>Couldn't reset module state. </font>"
elif
"Get link to student's progress page"
in
action
:
unique_student_identifier
=
request
.
POST
.
get
(
'unique_student_identifier'
,
''
)
try
:
if
"@"
in
unique_student_identifier
:
student_to_reset
=
User
.
objects
.
get
(
email
=
unique_student_identifier
)
else
:
student_to_reset
=
User
.
objects
.
get
(
username
=
unique_student_identifier
)
progress_url
=
reverse
(
'student_progress'
,
kwargs
=
{
'course_id'
:
course_id
,
'student_id'
:
student_to_reset
.
id
})
track
.
views
.
server_track
(
request
,
'{instructor} requested progress page for {student} in {course}'
.
format
(
student
=
student_to_reset
,
instructor
=
request
.
user
,
course
=
course_id
),
{},
page
=
'idashboard'
)
msg
+=
"<a href='{0}' target='_blank'> Progress page for username: {1} with email address: {2}</a>."
.
format
(
progress_url
,
student_to_reset
.
username
,
student_to_reset
.
email
)
except
:
msg
+=
"<font color='red'>Couldn't find student with that username. </font>"
#----------------------------------------
#----------------------------------------
# export grades to remote gradebook
# export grades to remote gradebook
...
...
lms/templates/courseware/instructor_dashboard.html
View file @
fd20496a
...
@@ -141,6 +141,11 @@ function goto( mode)
...
@@ -141,6 +141,11 @@ function goto( mode)
%endif
%endif
<H2>
Student-specific grade inspection and adjustment
</h2>
<p>
edX email address or their username:
</p>
<p><input
type=
"text"
name=
"unique_student_identifier"
>
<input
type=
"submit"
name=
"action"
value=
"Get link to student's progress page"
></p>
<p>
and, if you want to reset the number of attempts for a problem, the urlname of that problem
</p>
<p>
<input
type=
"text"
name=
"problem_to_reset"
>
<input
type=
"submit"
name=
"action"
value=
"Reset student's attempts"
>
</p>
%endif
%endif
##-----------------------------------------------------------------------------
##-----------------------------------------------------------------------------
...
@@ -282,6 +287,9 @@ function goto( mode)
...
@@ -282,6 +287,9 @@ function goto( mode)
</form>
</form>
%if msg:
<p></p><p>
${msg}
</p>
%endif
##-----------------------------------------------------------------------------
##-----------------------------------------------------------------------------
##-----------------------------------------------------------------------------
##-----------------------------------------------------------------------------
...
@@ -334,9 +342,6 @@ function goto( mode)
...
@@ -334,9 +342,6 @@ function goto( mode)
##-----------------------------------------------------------------------------
##-----------------------------------------------------------------------------
## always show msg
## always show msg
%if msg:
<p>
${msg}
</p>
%endif
##-----------------------------------------------------------------------------
##-----------------------------------------------------------------------------
%if modeflag.get('Admin'):
%if modeflag.get('Admin'):
...
...
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