From dff35f3b9be6427ef94b47a9e92c0fe6636075ed Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 2 Sep 2015 16:46:26 -0600 Subject: [PATCH] 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 Tested-by: Jenkins QA-Review: Charles Kimball Product-Review: Jeremy Stanley --- .../lib/qti/assessment_item_converter.rb | 1 + .../spec_canvas/fixtures/canvas/essay2.xml | 15 +++++++++++++++ .../spec_canvas/lib/qti/canvas_questions_spec.rb | 6 ++++++ .../spec_canvas/lib/qti/vista_questions_spec.rb | 2 +- 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gems/plugins/qti_exporter/spec_canvas/fixtures/canvas/essay2.xml diff --git a/gems/plugins/qti_exporter/lib/qti/assessment_item_converter.rb b/gems/plugins/qti_exporter/lib/qti/assessment_item_converter.rb index 44cf67d55af..e936d5f7459 100644 --- a/gems/plugins/qti_exporter/lib/qti/assessment_item_converter.rb +++ b/gems/plugins/qti_exporter/lib/qti/assessment_item_converter.rb @@ -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(',')) diff --git a/gems/plugins/qti_exporter/spec_canvas/fixtures/canvas/essay2.xml b/gems/plugins/qti_exporter/spec_canvas/fixtures/canvas/essay2.xml new file mode 100644 index 00000000000..51e2f24f351 --- /dev/null +++ b/gems/plugins/qti_exporter/spec_canvas/fixtures/canvas/essay2.xml @@ -0,0 +1,15 @@ + + + + + + +
+ + What is the difference between a tree? + + + diff --git a/gems/plugins/qti_exporter/spec_canvas/lib/qti/canvas_questions_spec.rb b/gems/plugins/qti_exporter/spec_canvas/lib/qti/canvas_questions_spec.rb index 47192cbaaba..5f5ccc36eaf 100644 --- a/gems/plugins/qti_exporter/spec_canvas/lib/qti/canvas_questions_spec.rb +++ b/gems/plugins/qti_exporter/spec_canvas/lib/qti/canvas_questions_spec.rb @@ -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) diff --git a/gems/plugins/qti_exporter/spec_canvas/lib/qti/vista_questions_spec.rb b/gems/plugins/qti_exporter/spec_canvas/lib/qti/vista_questions_spec.rb index c90b7282995..5e35dd59cde 100644 --- a/gems/plugins/qti_exporter/spec_canvas/lib/qti/vista_questions_spec.rb +++ b/gems/plugins/qti_exporter/spec_canvas/lib/qti/vista_questions_spec.rb @@ -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?
", + SHORT_ANSWER = {:question_text=>"We all live in what?
\n
\n
1.
", :incorrect_comments=>"", :question_type=>"short_answer_question", :answers=>