fix RQD grade display for submissions without scores
Fixes a bug where a student sees a grade on the submission details page when Restrict Quantitative Data is enabled and the teacher has not yet graded them. closes EVAL-4221 flag=restrict_quantitative_data Test Plan: * Preqrequisites: a course with restrict quantitative data enabled and Assignment Enhancements — Student disabled. 1. Create a letter grade assignment. Attach a rubric to the assignment. Ensure you leave "Use this rubric for assignment grading" unchecked. 2. Submit to the assignment as a student. 3. As an instructor, go to SpeedGrader and assign a rubric grade (but not an overall grade). 4. As the student, go to the assignment page (/courses/:course_id/assignments/:id) and verify no grade is shown. Then go to the submission details page (/courses/:course_id/assignments/:assignment_id/submissions/:user_id) and verify no grade is shown. Change-Id: Iec8622f34b9b2d5fd8d4812d231d0a09d0a5eb3d Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/348834 Reviewed-by: Cameron Ray <cameron.ray@instructure.com> Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com> Product-Review: Cameron Ray <cameron.ray@instructure.com> QA-Review: Kai Bjorkman <kbjorkman@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
parent
9af987d527
commit
1d074a95fa
|
@ -106,7 +106,7 @@ class Submission::ShowPresenter
|
|||
return @submission.entered_grade
|
||||
end
|
||||
|
||||
grade = @assignment.score_to_grade(@submission.score, nil, true)
|
||||
grade = @assignment.score_to_grade(@submission.score, nil, true) if @submission.score
|
||||
replace_dash_with_minus(grade)
|
||||
elsif @assignment.grading_type == "letter_grade"
|
||||
replace_dash_with_minus(@submission.entered_grade)
|
||||
|
|
|
@ -253,26 +253,33 @@ describe Submission::ShowPresenter do
|
|||
Submission::ShowPresenter.new(submission: @assignment.submissions.find_by(user: @student), current_user: @student)
|
||||
end
|
||||
|
||||
context "when restrict quantitative data is enabled" do
|
||||
before do
|
||||
course.root_account.enable_feature!(:restrict_quantitative_data)
|
||||
course.update!(restrict_quantitative_data: true)
|
||||
end
|
||||
|
||||
it "returns nil if the passed in grade is nil" do
|
||||
expect(presenter.entered_grade).to be_nil
|
||||
end
|
||||
|
||||
it "returns a letter grade with trailing en-dash replaced with minus" do
|
||||
@assignment.grade_student(@student, grader: @teacher, grade: "8")
|
||||
expect(presenter.entered_grade).to eq "B#{minus}"
|
||||
end
|
||||
|
||||
it "returns complete/incomplete if the assignment type is pass/fail" do
|
||||
@assignment.update!(grading_type: "pass_fail")
|
||||
@assignment.grade_student(@student, grader: @teacher, grade: "complete")
|
||||
expect(presenter.entered_grade).to eq "complete"
|
||||
end
|
||||
end
|
||||
|
||||
it "returns the entered grade" do
|
||||
@assignment.grade_student(@student, grader: @teacher, grade: "8")
|
||||
expect(presenter.entered_grade).to eq "8"
|
||||
end
|
||||
|
||||
it "returns a letter grade with trailing en-dash replaced with minus if 'Restrict Quantitative Data' is enabled" do
|
||||
course.root_account.enable_feature!(:restrict_quantitative_data)
|
||||
course.update!(restrict_quantitative_data: true)
|
||||
@assignment.grade_student(@student, grader: @teacher, grade: "8")
|
||||
expect(presenter.entered_grade).to eq "B#{minus}"
|
||||
end
|
||||
|
||||
it "returns complete/incomplete if the assignment type is pass/fail with 'Restrict Quantitative Data' enabled" do
|
||||
course.root_account.enable_feature!(:restrict_quantitative_data)
|
||||
course.update!(restrict_quantitative_data: true)
|
||||
@assignment.update!(grading_type: "pass_fail")
|
||||
@assignment.grade_student(@student, grader: @teacher, grade: "complete")
|
||||
expect(presenter.entered_grade).to eq "complete"
|
||||
end
|
||||
|
||||
it "returns a letter grade with trailing en-dash replaced with minus if the assignment type is letter grade" do
|
||||
@assignment.update!(grading_type: "letter_grade")
|
||||
@assignment.grade_student(@student, grader: @teacher, grade: "B#{en_dash}")
|
||||
|
|
Loading…
Reference in New Issue