show the quiz question title on the quiz statistics page

question data should use the :question_name key for question
names, so that key should be used when showing the title.

Test Plan:
 * Import a quiz from a QTI package
 * Take the quiz and view the statistics page
 * The title should be there.

closes #7065

Change-Id: I39a650cf0f0aa8a8534a0158d6b073dc261c87c3
Reviewed-on: https://gerrit.instructure.com/9738
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
This commit is contained in:
Bracken Mosbacker 2012-03-30 16:25:30 -06:00
parent 03424c9626
commit e51ffb965f
2 changed files with 39 additions and 1 deletions

View File

@ -11,7 +11,7 @@
<% first_column_done = true %>
<td class="question_name" rowspan="<%= rows %>">
<div class="question_name">
<%= question[:name] %>
<%= question[:question_name] || question[:name] %>
<div style="float: right;" style="width: 1px; height: 100px;"></div>
<div class="clear"></div>
</div>

View File

@ -0,0 +1,38 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../views_helper')
describe "/quizzes/_question_statistic" do
it "should render" do
course_with_student
view_context
assigns[:quiz] = @course.quizzes.create!
question = {}
question[:id] = 5
question[:answers] = []
question[:question_type] = "multiple_choice_question"
question[:question_name] = "title of glory"
question[:unexpected_response_values] = []
render :partial => "quizzes/question_statistic", :object => question, :locals => {:in_group => true, :ignore_correct_answers => true}
response.should_not be_nil
response.body.should =~ /title of glory/
end
end