added several problem types

This commit is contained in:
Lyla Fischer
2012-09-26 17:31:33 -04:00
parent 3449a74241
commit 949f638dd1
8 changed files with 50 additions and 55 deletions

View File

@@ -638,14 +638,13 @@ class CapaDescriptor(RawDescriptor):
stores_state = True
has_score = True
template_dir_name = 'problem'
# Capa modules have some additional metadata:
# TODO (vshnayder): do problems have any other metadata? Do they
# actually use type and points?
metadata_attributes = RawDescriptor.metadata_attributes + ('type', 'points')
template_dir_name = 'problem'
# VS[compat]
# TODO (cpennington): Delete this method once all fall 2012 course are being
# edited in the cms

View File

@@ -70,15 +70,15 @@ data: |
# of the diagram and analysis results for the i-th schematic tag
def get_tran(json,signal):
for element in json:
if element[0] == 'transient':
return element[1].get(signal,[])
return []
for element in json:
if element[0] == 'transient':
return element[1].get(signal,[])
return []
def get_value(at,output):
for (t,v) in output:
if at == t: return v
return None
for (t,v) in output:
if at == t: return v
return None
output = get_tran(submission[0],'Z')
okay = True

View File

@@ -2,7 +2,7 @@
metadata:
display_name: Custom Grader
data: |
<problem>
<problem>
<text>
<h2>Example: Custom Response Problem</h2>
@@ -12,11 +12,9 @@ data: |
python script embedded within the problem.
</p>
<script type="loncapa/python">
def test_add(expect,ans):
(a1,a2) = map(float,ans)
return (a1+a2)==10
<script type="loncapa/python">def test_add(expect,ans):
(a1,a2) = map(float,ans)
return (a1+a2)==10
</script>
@@ -29,5 +27,5 @@ data: |
</text>
</text>
</problem>
</problem>
children: []

View File

@@ -2,7 +2,7 @@
metadata:
display_name: Formula Repsonse
data: |
<problem>
<problem>
<text>
<h2>Example: Formula Response Problem</h2>
@@ -21,9 +21,7 @@ data: |
on the problem author to specify the allowed variables in the expression, and the
numerical ranges over which the variables must be sampled to test for correctness.</p>
<script type="loncapa/python">
I = "m*c^2"
</script>
<script type="loncapa/python">I = "m*c^2"</script>
<text>
<br/>
@@ -36,5 +34,5 @@ data: |
</formularesponse>
</text>
</problem>
</problem>
children: []

View File

@@ -2,7 +2,7 @@
metadata:
display_name: Image Response
data: |
<problem>
<problem>
<text>
<h2>Example: Image Response Problem</h2>
@@ -21,6 +21,6 @@ data: |
</imageresponse>
</text>
</text>
</problem>
</problem>
children: []

View File

@@ -2,7 +2,7 @@
metadata:
display_name: Multiple Choice
data: |
<problem>
<problem>
<text>
<h2>Example: Multiple Choice Response Problem</h2>
@@ -23,5 +23,5 @@ data: |
</choicegroup>
</multiplechoiceresponse>
</text>
</problem>
</problem>
children: []

View File

@@ -2,7 +2,7 @@
metadata:
display_name: Numerical Response
data: |
<problem>
<problem>
<text>
<h2>Example: Numerical Response Problem</h2>
@@ -24,5 +24,5 @@ data: |
</numericalresponse>
</p>
</text>
</problem>
</problem>
children: []

View File

@@ -4,37 +4,37 @@ metadata:
data: |
<problem >
<text>
<h2>Example: String Response Problem</h2>
<p>
A string response problem accepts a line of text input from the
student, and evaluates the input for correctness based on an expected
answer within each input box.
The answer is correct if it is the expected answer.
</p>
<h2>Example: String Response Problem</h2>
<p>
A string response problem accepts a line of text input from the
student, and evaluates the input for correctness based on an expected
answer within each input box.
The answer is correct if it is the expected answer.
</p>
</text>
<span style="display:inline">
<p style="display:inline">Which US state has Lansing as its capital? &#160; &#160;</p>
<stringresponse answer="Michigan" type="ci">
<textline size="20" inline="1"/>
<hintgroup>
<stringhint answer="wisconsin" type="cs" name="wisc">
</stringhint>
<stringhint answer="minnesota" type="cs" name="minn">
</stringhint>
<hintpart on="wisc">
<text>The state capital of Wisconsin is Madison.</text>
</hintpart>
<hintpart on="minn">
<text>The state capital of Minnesota is St. Paul.</text>
</hintpart>
<hintpart on="default">
<text>The state you are looking for is also known as the 'Great Lakes State'</text>
</hintpart>
</hintgroup>
</stringresponse>
<p style="display:inline">Which US state has Lansing as its capital? &#160; &#160;</p>
<stringresponse answer="Michigan" type="ci">
<textline size="20" inline="1"/>
<hintgroup>
<stringhint answer="wisconsin" type="cs" name="wisc">
</stringhint>
<stringhint answer="minnesota" type="cs" name="minn">
</stringhint>
<hintpart on="wisc">
<text>The state capital of Wisconsin is Madison.</text>
</hintpart>
<hintpart on="minn">
<text>The state capital of Minnesota is St. Paul.</text>
</hintpart>
<hintpart on="default">
<text>The state you are looking for is also known as the 'Great Lakes State'</text>
</hintpart>
</hintgroup>
</stringresponse>
</span>
</problem>