do not generate outcome results for ungraded essay questions
fixes OUT-357 test plan: - create two new outcomes - create a question bank only consisting of essay questions - create another bank consisting of a mix of essay questions - align banks to the outcomes - attach the banks to two separate quizzes - as a student, take both quizzes - as a teacher, go to the learning mastery gradebook - there should be no outcome score for either quiz - grade some, but not all of the essay questions - there should still not be any outcome scores - finish grading the essay questions - outcome scores should now be generated - remove a grade from one of the essay questions - outcome score should not change Change-Id: Ibf50842cf9a5e2e9f52214e6928e47b34323a001 Reviewed-on: https://gerrit.instructure.com/87098 Reviewed-by: Augusto Callejas <acallejas@instructure.com> Reviewed-by: Michael Brewer-Davis <mbd@instructure.com> QA-Review: Alex Ortiz-Rosado <aortiz@instructure.com> Product-Review: McCall Smith <mcsmith@instructure.com> Tested-by: Jenkins
This commit is contained in:
parent
e2ed5cb62f
commit
d745c6a73d
|
@ -5,6 +5,7 @@ module Quizzes
|
|||
end
|
||||
|
||||
def build_outcome_results(questions, alignments)
|
||||
return unless ['complete', 'graded'].include?(@qs.workflow_state)
|
||||
create_quiz_outcome_results(questions, alignments)
|
||||
questions.each do |question|
|
||||
alignments.each do |alignment|
|
||||
|
|
|
@ -19,18 +19,18 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
||||
|
||||
describe Quizzes::QuizOutcomeResultBuilder do
|
||||
def question_data(reset=false)
|
||||
def question_data(reset=false, data={})
|
||||
@qdc = (reset || !@qdc) ? 1 : @qdc + 1
|
||||
{:name => "question #{@qdc}", :points_possible => 1, 'question_type' => 'multiple_choice_question', 'answers' =>
|
||||
[{'answer_text' => '1', 'answer_weight' => '100'}, {'answer_text' => '2'}, {'answer_text' => '3'}, {'answer_text' => '4'}]
|
||||
}
|
||||
}.merge(data)
|
||||
end
|
||||
|
||||
def build_course_quiz_questions_and_a_bank
|
||||
def build_course_quiz_questions_and_a_bank(data={})
|
||||
course_with_student(:active_all => true)
|
||||
@quiz = @course.quizzes.create!(:title => "new quiz", :shuffle_answers => true)
|
||||
@q1 = @quiz.quiz_questions.create!(:question_data => question_data(true))
|
||||
@q2 = @quiz.quiz_questions.create!(:question_data => question_data)
|
||||
@q1 = @quiz.quiz_questions.create!(:question_data => question_data(true, data))
|
||||
@q2 = @quiz.quiz_questions.create!(:question_data => question_data(false, data))
|
||||
@outcome = @course.created_learning_outcomes.create!(:short_description => 'new outcome')
|
||||
@bank = @q1.assessment_question.assessment_question_bank
|
||||
@outcome.align(@bank, @bank.context, :mastery_score => 0.7)
|
||||
|
@ -41,6 +41,7 @@ describe Quizzes::QuizOutcomeResultBuilder do
|
|||
end
|
||||
|
||||
def answer_a_question(question, submission, correct: true)
|
||||
return if question.question_data['answers'] == []
|
||||
q_id = question.data[:id]
|
||||
answer = if correct
|
||||
find_the_answer_from_a_question(question)
|
||||
|
@ -205,4 +206,23 @@ describe Quizzes::QuizOutcomeResultBuilder do
|
|||
expect(@results.last.original_mastery).to eql(false)
|
||||
end
|
||||
end
|
||||
|
||||
describe "quizzes that aren't graded or complete" do
|
||||
before :once do
|
||||
build_course_quiz_questions_and_a_bank({'question_type' => 'essay_question', 'answers' => []})
|
||||
@quiz.generate_quiz_data(:persist => true)
|
||||
@sub = @quiz.generate_submission(@user)
|
||||
@sub.submission_data = {}
|
||||
answer_a_question(@q1, @sub)
|
||||
answer_a_question(@q2, @sub, correct: false)
|
||||
Quizzes::SubmissionGrader.new(@sub).grade_submission
|
||||
@outcome.reload
|
||||
@quiz_results = @outcome.learning_outcome_results.where(user_id: @user).to_a
|
||||
end
|
||||
|
||||
it "does not create an outcome result" do
|
||||
expect(@quiz_results).to be_empty
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue