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
e33b0957
Commit
e33b0957
authored
May 21, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved code examples into snippets
parent
6e147baa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
djangoapps/courseware/capa/responsetypes.py
+8
-11
No files found.
djangoapps/courseware/capa/responsetypes.py
View file @
e33b0957
...
@@ -66,10 +66,8 @@ class GenericResponse(object):
...
@@ -66,10 +66,8 @@ class GenericResponse(object):
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
class
MultipleChoiceResponse
(
GenericResponse
):
class
MultipleChoiceResponse
(
GenericResponse
):
'''
# TODO: handle direction and randomize
Example:
snippets
=
[{
'snippet'
:
'''<multiplechoiceresponse direction="vertical" randomize="yes">
<multiplechoiceresponse direction="vertical" randomize="yes">
<choicegroup type="MultipleChoice">
<choicegroup type="MultipleChoice">
<choice location="random" correct="false"><span>`a+b`<br/></span></choice>
<choice location="random" correct="false"><span>`a+b`<br/></span></choice>
<choice location="random" correct="true"><span><math>a+b^2</math><br/></span></choice>
<choice location="random" correct="true"><span><math>a+b^2</math><br/></span></choice>
...
@@ -77,10 +75,7 @@ class MultipleChoiceResponse(GenericResponse):
...
@@ -77,10 +75,7 @@ class MultipleChoiceResponse(GenericResponse):
<choice location="bottom" correct="false"><math>a+b+d</math></choice>
<choice location="bottom" correct="false"><math>a+b+d</math></choice>
</choicegroup>
</choicegroup>
</multiplechoiceresponse>
</multiplechoiceresponse>
'''
}]
TODO: handle direction and randomize
'''
def
__init__
(
self
,
xml
,
context
,
system
=
None
):
def
__init__
(
self
,
xml
,
context
,
system
=
None
):
self
.
xml
=
xml
self
.
xml
=
xml
self
.
correct_choices
=
xml
.
xpath
(
'//*[@id=$id]//choice[@correct="true"]'
,
self
.
correct_choices
=
xml
.
xpath
(
'//*[@id=$id]//choice[@correct="true"]'
,
...
@@ -218,8 +213,9 @@ class NumericalResponse(GenericResponse):
...
@@ -218,8 +213,9 @@ class NumericalResponse(GenericResponse):
class
CustomResponse
(
GenericResponse
):
class
CustomResponse
(
GenericResponse
):
'''
'''
Custom response. The python code to be run should be in <answer>...</answer>. Example:
Custom response. The python code to be run should be in <answer>...</answer>. Example:
'''
<customresponse>
snippets
=
[{
'snippet'
:
'''
<customresponse>
<startouttext/>
<startouttext/>
<br/>
<br/>
Suppose that
\
(I(t)
\
) rises from
\
(0
\
) to
\
(I_S
\
) at a time
\
(t_0
\n
eq 0
\
)
Suppose that
\
(I(t)
\
) rises from
\
(0
\
) to
\
(I_S
\
) at a time
\
(t_0
\n
eq 0
\
)
...
@@ -237,9 +233,10 @@ class CustomResponse(GenericResponse):
...
@@ -237,9 +233,10 @@ class CustomResponse(GenericResponse):
if not(r=="IS*u(t-t0)"):
if not(r=="IS*u(t-t0)"):
correct[0] ='incorrect'
correct[0] ='incorrect'
</answer>
</answer>
</customresponse>
</customresponse>
'''
}]
Alternatively, the check function can be defined in <script>...</script> Example:
'''Footnote: the check function can also be defined in <script>...</script> Example:
<script type="loncapa/python"><![CDATA[
<script type="loncapa/python"><![CDATA[
...
...
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