Fixes placeholder in essay question quiz grading
Fixes CNVS-8632 Test plan: - Publish a quiz with an essay question - Take the quiz - Grade the quiz - When no value is entered ('--' still present) the question should still be considered needing review - The '--' in the points field for the essay question should disappear if a value is entered. Change-Id: I6a6b0c15738c067f83722576cd3690e993c57e5d Reviewed-on: https://gerrit.instructure.com/55917 Tested-by: Jenkins Reviewed-by: John Corrigan <jcorrigan@instructure.com> QA-Review: Jason Carter <jcarter@instructure.com> Product-Review: Ryan Taylor <rtaylor@instructure.com>
This commit is contained in:
parent
38bb203b5b
commit
3509cf9c7f
|
@ -0,0 +1,5 @@
|
|||
require [
|
||||
'jquery'
|
||||
], ($) ->
|
||||
|
||||
$('.question_input').focus()
|
|
@ -661,7 +661,7 @@ module QuizzesHelper
|
|||
return user_answer[:points] unless user_answer[:correct] == 'undefined'
|
||||
|
||||
if ["assignment", "practice_quiz"].include?(@quiz.quiz_type)
|
||||
"--"
|
||||
""
|
||||
else
|
||||
question[:points_possible] || 0
|
||||
end
|
||||
|
|
|
@ -676,10 +676,15 @@ class Quizzes::QuizSubmission < ActiveRecord::Base
|
|||
answer = answer.with_indifferent_access
|
||||
score = params["question_score_#{answer["question_id"]}".to_sym]
|
||||
answer["more_comments"] = params["question_comment_#{answer["question_id"]}".to_sym] if params["question_comment_#{answer["question_id"]}".to_sym]
|
||||
if score != "--" && score.present? # != ""
|
||||
answer["points"] = (score.to_f rescue nil) || answer["points"] || 0
|
||||
answer["correct"] = "defined" if answer["correct"] == "undefined" && (score.to_f rescue nil)
|
||||
elsif score == "--"
|
||||
if score.present?
|
||||
begin
|
||||
float_score = score.to_f
|
||||
rescue
|
||||
float_score = nil
|
||||
end
|
||||
answer["points"] = float_score || answer["points"] || 0
|
||||
answer["correct"] = "defined" if answer["correct"] == "undefined" && float_score
|
||||
elsif score && score.empty?
|
||||
answer["points"] = 0
|
||||
answer["correct"] = "undefined"
|
||||
end
|
||||
|
|
|
@ -44,7 +44,13 @@
|
|||
<% if user_answer %>
|
||||
<div class="user_points" <%= hidden(true) if (assessing || assessment_results) && question_type && question_type.entry_type == "none" %>>
|
||||
<% if editable %>
|
||||
<input type="text" class="question_input" name="question_score_<%= hash_get(question, :id) %>" value="<%= number_with_precision(point_value_for_input(user_answer, question), precision: 2, strip_insignificant_zeros: true) %>" autocomplete='off'/>
|
||||
<input type="number" class="question_input"
|
||||
name="question_score_<%= hash_get(question, :id) %>" placeholder="--"
|
||||
value="<%= point_value_for_input(user_answer, question).is_a?(Float) &&
|
||||
!point_value_for_input(user_answer, question).nan? &&
|
||||
number_with_precision(point_value_for_input(user_answer, question), precision: 2, strip_insignificant_zeros: true) || ''
|
||||
%>"
|
||||
autocomplete='off'/>
|
||||
<% else %>
|
||||
<% if hash_get(user_answer, :correct) == "undefined" %>
|
||||
<%= t(:not_yet_graded, 'Not yet graded') %>
|
||||
|
@ -397,3 +403,5 @@
|
|||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% js_bundle :grade_question %>
|
||||
|
|
|
@ -121,7 +121,8 @@
|
|||
<% if editable %>
|
||||
<div class="update_scores_fudge">
|
||||
<label for="fudge_points_entry"><%= before_label(:fudge_points, "Fudge Points") %></label>
|
||||
<input id="fudge_points_entry" type="text" name="fudge_points" value="<%= (!@submission.fudge_points || @submission.fudge_points == 0 ? '--' : @submission.fudge_points) %>"/>
|
||||
<input type="hidden" name="fudge_points" value="<%= @submission.fudge_points || 0 %>">
|
||||
<input id="fudge_points_entry" type="number" name="fudge_points" value="<%= (!@submission.fudge_points || @submission.fudge_points == 0 ? '' : @submission.fudge_points) %>" placeholder="--" autocomplete='off' />
|
||||
<%
|
||||
fudge_text = begin
|
||||
if @submission.quiz_points_possible == @quiz.points_possible || !@submission.quiz_points_possible || !@quiz.points_possible
|
||||
|
|
|
@ -168,7 +168,7 @@ define([
|
|||
var $total = $("#after_fudge_points_total");
|
||||
var total = 0;
|
||||
$(".display_question .user_points:visible").each(function() {
|
||||
var points = parseFloat($(this).find(":text:first").val(), 10) || 0;
|
||||
var points = parseFloat($(this).find("input[type=number]").val(), 10) || 0;
|
||||
points = Math.round(points * 100.0) / 100.0;
|
||||
total = total + points;
|
||||
});
|
||||
|
@ -397,7 +397,7 @@ define([
|
|||
gradingForm.setInitialSnapshot(data);
|
||||
}
|
||||
|
||||
$(".question_holder .user_points :text,.question_holder .question_neutral_comment .question_comment_text textarea").change(function() {
|
||||
$(".question_holder .user_points input[type=number],.question_holder .question_neutral_comment .question_comment_text textarea").change(function() {
|
||||
var $question = $(this).parents(".display_question");
|
||||
var questionId = $question.attr('id');
|
||||
gradingForm.updateSnapshotFor($question);
|
||||
|
|
|
@ -473,10 +473,10 @@ describe QuizzesHelper do
|
|||
end
|
||||
end
|
||||
|
||||
it "returns -- if quiz is practice quiz or assignment" do
|
||||
it "returns empty if quiz is practice quiz or assignment" do
|
||||
['assignment', 'practice_quiz'].each do |quiz_type|
|
||||
@quiz.expects(:quiz_type).returns quiz_type
|
||||
expect(point_value_for_input(user_answer, question)).to eq "--"
|
||||
expect(point_value_for_input(user_answer, question)).to eq ""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -627,7 +627,7 @@ describe Quizzes::QuizSubmission do
|
|||
'context_type' => 'Course',
|
||||
'submission_version_number' => '1',
|
||||
"question_score_#{@questions[0].id}" => '1',
|
||||
"question_score_#{@questions[1].id}" => "--"
|
||||
"question_score_#{@questions[1].id}" => ""
|
||||
})
|
||||
expect(@quiz_submission.submission.workflow_state).to eql 'pending_review'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue