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
565f502c
Commit
565f502c
authored
Nov 20, 2012
by
Vik Paruchuri
Committed by
Victor Shnayder
Nov 29, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in prompt tag to openended response and parse/pass along properly
parent
e17db85d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
common/lib/capa/capa/responsetypes.py
+15
-3
No files found.
common/lib/capa/capa/responsetypes.py
View file @
565f502c
...
@@ -1845,9 +1845,10 @@ class OpenEndedResponse(LoncapaResponse):
...
@@ -1845,9 +1845,10 @@ class OpenEndedResponse(LoncapaResponse):
#Look for tag named openendedparam that encapsulates all grader settings
#Look for tag named openendedparam that encapsulates all grader settings
oeparam
=
self
.
xml
.
find
(
'openendedparam'
)
oeparam
=
self
.
xml
.
find
(
'openendedparam'
)
self
.
_parse_openendedresponse_xml
(
oeparam
)
prompt
=
self
.
xml
.
find
(
'prompt'
)
self
.
_parse_openendedresponse_xml
(
oeparam
,
prompt
)
def
_parse_openendedresponse_xml
(
self
,
oeparam
):
def
_parse_openendedresponse_xml
(
self
,
oeparam
,
prompt
):
'''
'''
Parse OpenEndedResponse XML:
Parse OpenEndedResponse XML:
self.initial_display
self.initial_display
...
@@ -1857,6 +1858,16 @@ class OpenEndedResponse(LoncapaResponse):
...
@@ -1857,6 +1858,16 @@ class OpenEndedResponse(LoncapaResponse):
self.answer - What to display when show answer is clicked
self.answer - What to display when show answer is clicked
'''
'''
# Note that OpenEndedResponse is agnostic to the specific contents of grader_payload
# Note that OpenEndedResponse is agnostic to the specific contents of grader_payload
#Modify code from stringify_children in xmodule. Didn't import directly in order to avoid capa depending
#on xmodule (seems to be avoided in code)
prompt_parts
=
[
prompt
.
text
]
[
prompt_parts
.
append
((
etree
.
tostring
(
p
,
with_tail
=
True
)))
for
p
in
prompt
.
getchildren
()]
prompt_string
=
' '
.
join
(
prompt_parts
)
#Strip html tags from prompt. This may need to be removed in order to display prompt to instructors properly.
prompt_string
=
re
.
sub
(
'<[^<]+?>'
,
''
,
prompt_string
)
grader_payload
=
oeparam
.
find
(
'grader_payload'
)
grader_payload
=
oeparam
.
find
(
'grader_payload'
)
grader_payload
=
grader_payload
.
text
if
grader_payload
is
not
None
else
''
grader_payload
=
grader_payload
.
text
if
grader_payload
is
not
None
else
''
...
@@ -1867,7 +1878,8 @@ class OpenEndedResponse(LoncapaResponse):
...
@@ -1867,7 +1878,8 @@ class OpenEndedResponse(LoncapaResponse):
org
,
course
,
type
,
name
=
location
.
split
(
"/"
)
org
,
course
,
type
,
name
=
location
.
split
(
"/"
)
grader_payload
.
update
({
grader_payload
.
update
({
'location'
:
location
,
'location'
:
location
,
'course_id'
:
"{0}/{1}"
.
format
(
org
,
course
)
'course_id'
:
"{0}/{1}"
.
format
(
org
,
course
),
'prompt'
:
prompt_string
})
})
grader_payload
=
json
.
dumps
(
grader_payload
)
grader_payload
=
json
.
dumps
(
grader_payload
)
except
Exception
as
err
:
except
Exception
as
err
:
...
...
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