fix blank essay question prompt on import

test plan:
 - import the package attached to the ticket
 - the essay questions should have prompts

fixes CNVS-22435

Change-Id: I2e623f7f73609c06be2b3f4b8202885d787d3255
Reviewed-on: https://gerrit.instructure.com/62426
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Charles Kimball <ckimball@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
Jeremy Stanley 2015-09-02 16:46:26 -06:00
parent 9f34f62be9
commit dff35f3b9b
4 changed files with 23 additions and 1 deletions

View File

@ -89,6 +89,7 @@ class AssessmentItemConverter
unless ['fill_in_multiple_blanks_question', 'canvas_matching', 'matching_question',
'multiple_dropdowns_question', 'respondus_matching'].include?(type)
selectors << 'itemBody > choiceInteraction > prompt'
selectors << 'itemBody > extendedTextInteraction > prompt'
end
text_nodes = @doc.css(selectors.join(','))

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1p1.xsd"
identifier="res_-FGM_FL15E_CAR_G08U2M5QB_004" title="-FGM_FL15E_CAR_G08U2M5QB_004" adaptive="false"
timeDependent="false">
<responseDeclaration baseType="string" cardinality="single" identifier="RESPONSE"/>
<outcomeDeclaration identifier="FEEDBACK" cardinality="single" baseType="identifier"/>
<outcomeDeclaration identifier="SCORE" cardinality="single" baseType="float"/>
<itemBody>
<div/>
<extendedTextInteraction responseIdentifier="RESPONSE" expectedLength="600">
<prompt>What is the difference between a tree?</prompt>
</extendedTextInteraction>
</itemBody>
</assessmentItem>

View File

@ -38,6 +38,12 @@ describe "Converting Canvas QTI" do
expect(hash).to eq CanvasExpected::ESSAY
end
it "should prefer extendedTextInteraction > prompt over empty div when convering essays" do
manifest_node=get_manifest_node('essay2')
hash = Qti::AssessmentItemConverter.create_instructure_question(:manifest_node=>manifest_node, :base_dir=>CANVAS_FIXTURE_DIR)
expect(hash[:question_text]).to include "What is the difference between a tree?"
end
it "should convert short answer" do
manifest_node=get_manifest_node('short_answer')
hash = Qti::AssessmentItemConverter.create_instructure_question(:manifest_node=>manifest_node, :base_dir=>CANVAS_FIXTURE_DIR)

View File

@ -260,7 +260,7 @@ module VistaExpected
:question_name=>"Essay Question"}.with_indifferent_access
# removed ids on the answers
SHORT_ANSWER = {:question_text=>"We all live in what?<br>",
SHORT_ANSWER = {:question_text=>"We all live in what?<br>\n<br/>\n<div class=\"html\">1. </div>",
:incorrect_comments=>"",
:question_type=>"short_answer_question",
:answers=>