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
0076d6a6
Commit
0076d6a6
authored
Jul 30, 2013
by
Adam Palay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix error handling
distinguish logged error and instructor-facing error
parent
bbd52e05
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
15 deletions
+37
-15
lms/djangoapps/instructor/views.py
+37
-15
No files found.
lms/djangoapps/instructor/views.py
View file @
0076d6a6
...
@@ -310,7 +310,9 @@ def instructor_dashboard(request, course_id):
...
@@ -310,7 +310,9 @@ def instructor_dashboard(request, course_id):
"Delete student state for module"
in
action
or
"Delete student state for module"
in
action
or
"Rescore student's problem submission"
in
action
):
"Rescore student's problem submission"
in
action
):
# get the form data
# get the form data
unique_student_identifier
=
request
.
POST
.
get
(
'unique_student_identifier'
,
''
)
unique_student_identifier
=
request
.
POST
.
get
(
'unique_student_identifier'
,
''
)
problem_urlname
=
request
.
POST
.
get
(
'problem_for_student'
,
''
)
problem_urlname
=
request
.
POST
.
get
(
'problem_for_student'
,
''
)
module_state_key
=
get_module_url
(
problem_urlname
)
module_state_key
=
get_module_url
(
problem_urlname
)
# try to uniquely id student by email address or username
# try to uniquely id student by email address or username
...
@@ -327,22 +329,35 @@ def instructor_dashboard(request, course_id):
...
@@ -327,22 +329,35 @@ def instructor_dashboard(request, course_id):
)
)
msg
+=
"Found module. "
msg
+=
"Found module. "
except
StudentModule
.
DoesNotExist
as
err
:
except
StudentModule
.
DoesNotExist
as
err
:
msg
+=
"<font color='red'>Couldn't find module with that urlname. </font>"
error_msg
=
"Couldn't find module with that urlname: {0}. "
.
format
(
msg
+=
"<font color='red'>Error: {0} </font>"
.
format
(
err
.
message
)
problem_urlname
log
.
exception
(
msg
)
)
msg
+=
"<font color='red'>"
+
error_msg
+
"({0}) "
.
format
(
err
)
+
"</font>"
log
.
debug
(
error_msg
)
if
student_module
is
not
None
:
if
student_module
is
not
None
:
if
"Delete student state for module"
in
action
:
if
"Delete student state for module"
in
action
:
# delete the state
# delete the state
try
:
try
:
student_module
.
delete
()
student_module
.
delete
()
msg
+=
"<font color='red'>Deleted student module state for
%
s!</font>"
%
module_state_key
msg
+=
"<font color='red'>Deleted student module state for {0}!</font>"
.
format
(
module_state_key
)
event
=
{
"problem"
:
problem_url
,
"student"
:
unique_student_identifier
,
"course"
:
course_id
}
event
=
{
track
.
views
.
server_track
(
request
,
"delete-student-module-state"
,
event
,
page
=
"idashboard"
)
"problem"
:
problem_url
,
"student"
:
unique_student_identifier
,
"course"
:
course_id
}
track
.
views
.
server_track
(
request
,
"delete-student-module-state"
,
event
,
page
=
"idashboard"
)
except
Exception
as
err
:
except
Exception
as
err
:
msg
+=
"Failed to delete module state for {0}/{1} "
.
format
(
unique_student_identifier
,
problem_urlname
)
error_msg
=
"Failed to delete module state for {0}/{1}. "
.
format
(
msg
+=
"<font color='red'>Error: {0} </font>"
.
format
(
err
.
message
)
unique_student_identifier
,
problem_urlname
log
.
exception
(
msg
)
)
msg
+=
"<font color='red'>"
+
error_msg
+
"({0}) "
.
format
(
err
)
+
"</font>"
log
.
exception
(
error_msg
)
elif
"Reset student's attempts"
in
action
:
elif
"Reset student's attempts"
in
action
:
# modify the problem's state
# modify the problem's state
try
:
try
:
...
@@ -363,9 +378,11 @@ def instructor_dashboard(request, course_id):
...
@@ -363,9 +378,11 @@ def instructor_dashboard(request, course_id):
track
.
views
.
server_track
(
request
,
"reset-student-attempts"
,
event
,
page
=
"idashboard"
)
track
.
views
.
server_track
(
request
,
"reset-student-attempts"
,
event
,
page
=
"idashboard"
)
msg
+=
"<font color='green'>Module state successfully reset!</font>"
msg
+=
"<font color='green'>Module state successfully reset!</font>"
except
Exception
as
err
:
except
Exception
as
err
:
msg
+=
"<font color='red'>Couldn't reset module state. </font>"
error_msg
=
"Couldn't reset module state for {0}/{1}. "
.
format
(
msg
+=
"<font color='red'>Error: {0} </font>"
.
format
(
err
.
message
)
unique_student_identifier
,
problem_urlname
log
.
exception
(
msg
)
)
msg
+=
"<font color='red'>"
+
error_msg
+
"({0}) "
.
format
(
err
)
+
"</font>"
log
.
exception
(
error_msg
)
else
:
else
:
# "Rescore student's problem submission" case
# "Rescore student's problem submission" case
try
:
try
:
...
@@ -375,8 +392,13 @@ def instructor_dashboard(request, course_id):
...
@@ -375,8 +392,13 @@ def instructor_dashboard(request, course_id):
else
:
else
:
track
.
views
.
server_track
(
request
,
"rescore-student-submission"
,
{
"problem"
:
module_state_key
,
"student"
:
unique_student_identifier
,
"course"
:
course_id
},
page
=
"idashboard"
)
track
.
views
.
server_track
(
request
,
"rescore-student-submission"
,
{
"problem"
:
module_state_key
,
"student"
:
unique_student_identifier
,
"course"
:
course_id
},
page
=
"idashboard"
)
except
Exception
as
err
:
except
Exception
as
err
:
msg
+=
'<font color="red">Failed to create a background task for rescoring "{0}": {1}.</font>'
.
format
(
module_state_key
,
err
.
message
)
msg
+=
'<font color="red">Failed to create a background task for rescoring "{0}": {1}.</font>'
.
format
(
log
.
exception
(
msg
)
module_state_key
,
err
.
message
)
log
.
exception
(
"Encountered exception from rescore: student '{0}' problem '{1}'"
.
format
(
unique_student_identifier
,
module_state_key
)
)
elif
"Get link to student's progress page"
in
action
:
elif
"Get link to student's progress page"
in
action
:
unique_student_identifier
=
request
.
POST
.
get
(
'unique_student_identifier'
,
''
)
unique_student_identifier
=
request
.
POST
.
get
(
'unique_student_identifier'
,
''
)
...
...
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