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
827e211a
Commit
827e211a
authored
Sep 16, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reveal student input at state of problem reset back to student
parent
1a02cfec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
common/lib/xmodule/xmodule/capa_module.py
+22
-4
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
827e211a
import
cgi
import
datetime
import
dateutil
import
dateutil.parser
...
...
@@ -236,16 +237,33 @@ class CapaModule(XModule):
# to avoid bricking of problem as much as possible
# Presumably, student submission has corrupted LoncapaProblem HTML.
# So, let's try generate a fresh LoncapaProblem
# First, pull down all student answers
student_answers
=
self
.
lcp
.
student_answers
answer_ids
=
student_answers
.
keys
()
# Some inputtypes, such as dynamath, have additional "hidden" state that
# is not exposed to the student. Keep those hidden
hidden_state_keywords
=
[
'dynamath'
]
for
answer_id
in
answer_ids
:
for
hidden_state_keyword
in
hidden_state_keywords
:
if
answer_id
.
find
(
hidden_state_keyword
)
>=
0
:
student_answers
.
pop
(
answer_id
)
# Next, generate a fresh LoncapaProblem
self
.
lcp
=
LoncapaProblem
(
self
.
definition
[
'data'
],
self
.
location
.
html_id
(),
state
=
None
,
# Tabula rasa
seed
=
self
.
seed
,
system
=
self
.
system
)
# Prepend a scary warning to the student
warning
=
'<div class="capa_reset">'
warning
+=
'<p>Problem state was corruped by invalid input. '
warning
+=
'Problem reset to initial state! '
warning
+=
'If problem persists, please contact the course staff.</p>'
warning
+=
'<h2>Problem reset to initial state!</h2>'
warning
+=
'<p>Problem state was corruped by invalid submission. The submission consisted of:</p>'
warning
+=
'<ul>'
for
student_answer
in
student_answers
.
values
():
if
student_answer
!=
''
:
warning
+=
'<li>'
+
cgi
.
escape
(
student_answer
)
+
'</li>'
warning
+=
'</ul>'
warning
+=
'<p>If problem persists, please contact the course staff.</p>'
warning
+=
'</div>'
html
=
warning
...
...
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