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
12be1d1c
Commit
12be1d1c
authored
May 27, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add textbox input type to customresponse
parent
55e25f83
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
djangoapps/courseware/capa/responsetypes.py
+10
-1
No files found.
djangoapps/courseware/capa/responsetypes.py
View file @
12be1d1c
...
@@ -264,6 +264,7 @@ def sympy_check2():
...
@@ -264,6 +264,7 @@ def sympy_check2():
## what's in xml. @id=id keeps us in the right customresponse.
## what's in xml. @id=id keeps us in the right customresponse.
self
.
answer_ids
=
xml
.
xpath
(
'//*[@id=$id]//textline/@id'
,
self
.
answer_ids
=
xml
.
xpath
(
'//*[@id=$id]//textline/@id'
,
id
=
xml
.
get
(
'id'
))
id
=
xml
.
get
(
'id'
))
self
.
answer_ids
+=
[
x
.
get
(
'id'
)
for
x
in
xml
.
findall
(
'textbox'
)]
# also allow textbox inputs
self
.
context
=
context
self
.
context
=
context
# if <customresponse> has an "expect" attribute then save that
# if <customresponse> has an "expect" attribute then save that
...
@@ -313,7 +314,13 @@ def sympy_check2():
...
@@ -313,7 +314,13 @@ def sympy_check2():
return
default
return
default
idset
=
sorted
(
self
.
answer_ids
)
# ordered list of answer id's
idset
=
sorted
(
self
.
answer_ids
)
# ordered list of answer id's
submission
=
[
student_answers
[
k
]
for
k
in
idset
]
# ordered list of answers
try
:
submission
=
[
student_answers
[
k
]
for
k
in
idset
]
# ordered list of answers
except
Exception
,
err
:
msg
=
'[courseware.capa.responsetypes.customresponse] error getting student answer from
%
s'
%
student_answers
msg
+=
'
\n
idset =
%
s, error =
%
s'
%
(
idset
,
err
)
raise
Exception
,
msg
fromjs
=
[
getkey2
(
student_answers
,
k
+
'_fromjs'
,
None
)
for
k
in
idset
]
# ordered list of fromjs_XXX responses (if exists)
fromjs
=
[
getkey2
(
student_answers
,
k
+
'_fromjs'
,
None
)
for
k
in
idset
]
# ordered list of fromjs_XXX responses (if exists)
# if there is only one box, and it's empty, then don't evaluate
# if there is only one box, and it's empty, then don't evaluate
...
@@ -359,6 +366,8 @@ def sympy_check2():
...
@@ -359,6 +366,8 @@ def sympy_check2():
ret
=
fn
(
self
.
expect
,
answer_given
,
student_answers
)
ret
=
fn
(
self
.
expect
,
answer_given
,
student_answers
)
else
:
else
:
ret
=
fn
(
self
.
expect
,
answer_given
)
ret
=
fn
(
self
.
expect
,
answer_given
)
if
settings
.
DEBUG
:
print
'[courseware.capa.responsetypes.customresponse] answer_given=
%
s'
%
answer_given
except
Exception
,
err
:
except
Exception
,
err
:
print
"oops in customresponse (cfn) error
%
s"
%
err
print
"oops in customresponse (cfn) error
%
s"
%
err
# print "context = ",self.context
# print "context = ",self.context
...
...
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