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
9ef1a4de
Commit
9ef1a4de
authored
Jan 15, 2013
by
John Hess
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tracking problem resets, clearer msgs
parent
d025ca24
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
lms/djangoapps/instructor/views.py
+19
-7
No files found.
lms/djangoapps/instructor/views.py
View file @
9ef1a4de
...
...
@@ -190,24 +190,36 @@ def instructor_dashboard(request, course_id):
student_to_reset
=
User
.
objects
.
get
(
username
=
unique_student_identifier
)
msg
+=
"Found a single student to reset. "
except
:
msg
+=
"<font color='red'>Couldn't find student to reset. </font>"
student_to_reset
=
None
msg
+=
"<font color='red'>Couldn't find student with that email or username. </font>"
# find the module in question
try
:
module_to_reset
=
StudentModule
.
objects
.
get
(
student_id
=
student_to_reset
.
id
,
course_id
=
course_id
,
module_state_key__iendswith
=
"/problem/"
+
problem_to_reset
)
msg
+=
"Found module to reset. "
except
Exception
as
e
:
msg
+=
"<font color='red'>Couldn't find module to reset. </font>"
if
student_to_reset
is
not
None
:
# find the module in question
try
:
module_to_reset
=
StudentModule
.
objects
.
get
(
student_id
=
student_to_reset
.
id
,
course_id
=
course_id
,
module_state_key__iendswith
=
"/problem/"
+
problem_to_reset
)
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>"
...
...
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