expand angel fill-in-multiple-blanks question answer importing

test plan:
* import the package referenced in the ticket
* check the quiz titled "Test 7"
* check the question titled
 "3.3 find p-value two-tailed mu with website"
* confirm that the question has answers

fixes #CNVS-5672

Change-Id: I8e2597475ead30a10e57b9a9edac18c0e10d6fe6
Reviewed-on: https://gerrit.instructure.com/24677
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
This commit is contained in:
James Williams 2013-09-25 08:33:36 -06:00
parent b56d8dca5d
commit 66799050ba
3 changed files with 36 additions and 13 deletions

View File

@ -40,10 +40,11 @@ class FillInTheBlank < AssessmentItemConverter
@question[:question_text] = body
@doc.search('responseProcessing responseCondition').each do |cond|
cond.css('stringMatch,substring').each do |match|
cond.css('stringMatch,substring,equalRounded,equal').each do |match|
answer = {}
answer[:text] = match.at_css('baseValue[baseType=string]').text.strip
unless answer[:text] == ""
node = match.at_css('baseValue[baseType=string],baseValue[baseType=integer],baseValue[baseType=float]')
answer[:text] = node.text.strip if node
unless answer[:text].blank?
@question[:answers] << answer
answer[:weight] = AssessmentItemConverter::DEFAULT_CORRECT_WEIGHT
answer[:comments] = ""

View File

@ -7,6 +7,8 @@
<itemBody><![CDATA[<div>The ]]><textEntryInteraction responseIdentifier="l1" expectedLength="10"/><![CDATA[ brown ]]>
<textEntryInteraction responseIdentifier="l2" expectedLength="10"/><![CDATA[ jumped over the lazy ]]>
<textEntryInteraction responseIdentifier="l3" expectedLength="10"/><![CDATA[.</div>]]><![CDATA[<div></div>]]>
<textEntryInteraction responseIdentifier="l4" expectedLength="10"/>
<textEntryInteraction responseIdentifier="l5" expectedLength="10"/>
</itemBody>
<responseDeclaration identifier="l1" cardinality="single" baseType="string"/>
<outcomeDeclaration identifier="l1_score" cardinality="single" baseType="float">
@ -26,6 +28,18 @@
<value>0</value>
</defaultValue>
</outcomeDeclaration>
<responseDeclaration identifier="l4" cardinality="single" baseType="string"/>
<outcomeDeclaration identifier="l4_score" cardinality="single" baseType="float">
<defaultValue>
<value>0</value>
</defaultValue>
</outcomeDeclaration>
<responseDeclaration identifier="l5" cardinality="single" baseType="string"/>
<outcomeDeclaration identifier="l5_score" cardinality="single" baseType="float">
<defaultValue>
<value>0</value>
</defaultValue>
</outcomeDeclaration>
<responseProcessing>
<responseCondition>
<responseIf>
@ -80,19 +94,25 @@
</responseCondition>
<responseCondition>
<responseIf>
<lt>
<variable identifier="SCORE"/>
<baseValue baseType="float">0</baseValue>
</lt>
<equalRounded roundingMode="decimalPlaces" figures="0">
<variable identifier="l4"/>
<baseValue baseType="float">0.02</baseValue>
</equalRounded>
<setOutcomeValue identifier="l4_score">
<baseValue baseType="float">0.7</baseValue>
</setOutcomeValue>
<setOutcomeValue identifier="SCORE">
<baseValue baseType="float">0</baseValue>
</setOutcomeValue>
</responseIf>
<responseElseIf>
<gt>
<variable identifier="SCORE"/>
<baseValue baseType="float">1</baseValue>
</gt>
<equal>
<variable identifier="l5"/>
<baseValue baseType="integer">5</baseValue>
</equal>
<setOutcomeValue identifier="l5_score">
<baseValue baseType="float">0.8</baseValue>
</setOutcomeValue>
<setOutcomeValue identifier="SCORE">
<baseValue baseType="float">1</baseValue>
</setOutcomeValue>

View File

@ -238,13 +238,15 @@ module AngelPropExpected
:answers=>
[{:text=>"quick", :weight=>100, :comments=>"", :blank_id=>"l1"},
{:text=>"fox", :weight=>100, :comments=>"", :blank_id=>"l2"},
{:text=>"dog", :weight=>100, :comments=>"", :blank_id=>"l3"}],
{:text=>"dog", :weight=>100, :comments=>"", :blank_id=>"l3"},
{:text=>"0.02", :weight=>100, :comments=>"", :blank_id=>"l4"},
{:text=>"5", :weight=>100, :comments=>"", :blank_id=>"l5"}],
:correct_comments=>"",
:incorrect_comments=>"",
:question_name=>"Fill in the blank(s)",
:migration_id=>"",
:points_possible=>1,
:question_text=>"<div>The [l1] brown [l2] jumped over the lazy [l3] .</div>",
:question_text=>"<div>The [l1] brown [l2] jumped over the lazy [l3] .</div> [l4] [l5] ",
:question_type=>"fill_in_multiple_blanks_question"}
end