copy feedback for file_upload_questions

test plan:
* create a quiz with a file upload question with
 a comment
* copy the course
* the copied question should preserve the comment

closes #QO-88

Change-Id: I479d1f03f11cb00b727300c423ec2632286c8bc7
Reviewed-on: https://gerrit.instructure.com/171924
Tested-by: Jenkins
Reviewed-by: Mysti Sadler <mysti@instructure.com>
QA-Review: Mysti Sadler <mysti@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
James Williams 2018-11-12 08:15:43 -07:00
parent 544e38bb04
commit bf7170d492
4 changed files with 16 additions and 2 deletions

View File

@ -143,6 +143,7 @@ class AssessmentItemConverter
elsif !%w(text_only_question file_upload_question).include?(@migration_type)
self.parse_question_data
else
self.get_feedback if @migration_type == 'file_upload_question'
@question[:question_type] ||= @migration_type
end
rescue => e

View File

@ -255,7 +255,7 @@ module AngelPropExpected
:answers=>[],
:correct_comments=>"",
:question_name=>"offline item?",
:incorrect_comments=>"",
:incorrect_comments=>"asdf",
:migration_id=>nil,
:points_possible=>1,
:question_type=>"file_upload_question",

View File

@ -129,7 +129,7 @@ module CC
presentation_options(pres_node, question)
end # presentation
unless ['text_only_question', 'file_upload_question'].include?(question['question_type'])
if question['question_type'] != 'text_only_question'
item_node.resprocessing do |res_node|
res_node.outcomes do |out_node|
out_node.decvar(

View File

@ -1107,6 +1107,19 @@ equation: <img class="equation_image" title="Log_216" src="/equation_images/Log_
expect(q2.question_data['answers'].first['comments_html']).to eq text
end
it "should copy neutral feedback for file upload questions" do
q = @copy_from.quizzes.create!(:title => "q")
data = {"question_type" => "file_upload_question", 'name' => 'test question', "neutral_comments_html" => "<i>comment</i>", "neutral_comments" => "comment"}
qq = q.quiz_questions.create!(:question_data => data)
run_course_copy
q2 = @copy_to.quizzes.first
qq2 = q2.quiz_questions.first
expect(qq2.question_data['neutral_comments_html']).to eq data['neutral_comments_html']
expect(qq2.question_data['neutral_comments']).to eq data['neutral_comments']
end
describe "assignment overrides" do
before :once do
@quiz_plain = @copy_from.quizzes.create!(title: 'my quiz')