Revert "don't fulfill must_submit requirements on manual 0 grade"
This reverts commit 499aa1ca88
.
closes #CNVS-20564
Change-Id: If916cb992d520abf71b9a4c804dafa8d272fce3f
Reviewed-on: https://gerrit.instructure.com/54756
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
This commit is contained in:
parent
5a5a1349e4
commit
9a282ae150
|
@ -158,9 +158,7 @@ class ContextModuleProgression < ActiveRecord::Base
|
|||
calc.requirement_met(req, false)
|
||||
elsif req[:type] == 'must_submit'
|
||||
sub = get_submission_or_quiz_submission(tag)
|
||||
req_met = sub && %w(submitted graded complete pending_review).include?(sub.workflow_state)
|
||||
req_met = false if sub && sub.graded? && get_submission_score(sub) == 0
|
||||
calc.requirement_met(req, req_met)
|
||||
calc.requirement_met(req, sub && %w(submitted graded complete pending_review).include?(sub.workflow_state))
|
||||
elsif req[:type] == 'min_score' || req[:type] == 'max_score'
|
||||
calc.requirement_met(req, evaluate_score_requirement_met(req, tag)) if tag.scoreable?
|
||||
end
|
||||
|
@ -186,7 +184,8 @@ class ContextModuleProgression < ActiveRecord::Base
|
|||
end
|
||||
private :get_submission_or_quiz_submission
|
||||
|
||||
def get_submission_score(submission)
|
||||
def get_submission_score(tag)
|
||||
submission = get_submission_or_quiz_submission(tag)
|
||||
if submission.is_a?(Quizzes::QuizSubmission)
|
||||
submission.try(:kept_score)
|
||||
else
|
||||
|
@ -196,8 +195,7 @@ class ContextModuleProgression < ActiveRecord::Base
|
|||
private :get_submission_score
|
||||
|
||||
def evaluate_score_requirement_met(requirement, tag)
|
||||
sub = get_submission_or_quiz_submission(tag)
|
||||
score = get_submission_score(sub)
|
||||
score = get_submission_score(tag)
|
||||
if requirement[:type] == "max_score"
|
||||
score.present? && score <= requirement[:max_score].to_f
|
||||
else
|
||||
|
@ -213,7 +211,6 @@ class ContextModuleProgression < ActiveRecord::Base
|
|||
requirement_met = true
|
||||
requirement_met = points && points >= requirement[:min_score].to_f if requirement[:type] == 'min_score'
|
||||
requirement_met = points && points <= requirement[:max_score].to_f if requirement[:type] == 'max_score'
|
||||
requirement_met = points > 0 if points && action == :scored && requirement[:type] == 'must_submit'
|
||||
if !requirement_met
|
||||
self.requirements_met.delete(requirement)
|
||||
self.mark_as_outdated
|
||||
|
|
|
@ -645,8 +645,7 @@ class Quizzes::QuizSubmission < ActiveRecord::Base
|
|||
if self.quiz && self.user
|
||||
if self.score
|
||||
self.quiz.context_module_action(self.user, :scored, self.kept_score)
|
||||
end
|
||||
if self.finished_at
|
||||
elsif self.finished_at
|
||||
self.quiz.context_module_action(self.user, :submitted)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -566,44 +566,6 @@ describe ContextModule do
|
|||
expect(@module2.evaluate_for(@user)).to be_completed
|
||||
expect(@module.evaluate_for(@user)).to be_completed
|
||||
end
|
||||
|
||||
it "should not unlock assignment must_submit requirement on manual zero grade" do
|
||||
course_module
|
||||
student_in_course course: @course, active_all: true
|
||||
|
||||
@teacher = User.create!(:name => "some teacher")
|
||||
@course.enroll_teacher(@teacher)
|
||||
|
||||
@assign = @course.assignments.create!(title: 'how many roads must a man walk down?', submission_types: 'online_text_entry')
|
||||
@tag = @module.add_item({id: @assign.id, type: 'assignment'})
|
||||
@module.completion_requirements = {@tag.id => {type: 'must_submit'}}
|
||||
@module.save!
|
||||
|
||||
expect(@module.evaluate_for(@student)).to be_unlocked
|
||||
|
||||
@assign.reload
|
||||
@assign.grade_student(@student, :grade => "0", :grader => @teacher)
|
||||
|
||||
expect(@module.evaluate_for(@student)).to be_unlocked
|
||||
end
|
||||
|
||||
it "should not unlock quiz must_submit requirement on manual zero grade" do
|
||||
course_module
|
||||
student_in_course course: @course, active_all: true
|
||||
|
||||
@teacher = User.create!(:name => "some teacher")
|
||||
@course.enroll_teacher(@teacher)
|
||||
|
||||
@quiz = @course.quizzes.build(:title => "some quiz", :quiz_type => "assignment", :scoring_policy => 'keep_highest')
|
||||
@quiz.workflow_state = 'available'
|
||||
@quiz.save!
|
||||
@tag = @module.add_item({:id => @quiz.id, :type => 'quiz'})
|
||||
@module.completion_requirements = {@tag.id => {:type => 'must_submit'}}
|
||||
@module.save!
|
||||
|
||||
@quiz.assignment.grade_student(@student, :grade => "0", :grader => @teacher)
|
||||
expect(@module.evaluate_for(@student)).to be_unlocked
|
||||
end
|
||||
|
||||
it "should mark progression completed for min_score on discussion topic assignment" do
|
||||
asmnt = assignment_model(:submission_types => "discussion_topic", :points_possible => 10)
|
||||
|
|
Loading…
Reference in New Issue