fix leak of unmuted score when escaping out of what-if edit
This adds GradeSummaryAssignmentPresenter#original_points, which won't share the published_score with the grade_summary page if the assignment is muted or the submission is nil. fixes CNVS-36928 test plan: - Have a course with a teacher, a student, and an assignment. - As the teacher, mute the assignment and grade the student - As the student, visit the grade summary page. - Select the muted icon to go into what-if editing mode, but hit escape without entering any data. - Note that the total score remains the same as it originally was - Select the muted icon and enter a what-if score. Rever that score. - Note that the total score the same as it originally was Change-Id: I9a30dcd09e2c7c10d4c70a1fdea7a764db5a127c Reviewed-on: https://gerrit.instructure.com/111925 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Jenkins Reviewed-by: Neil Gupta <ngupta@instructure.com> QA-Review: Anju Reddy <areddy@instructure.com> Product-Review: Keith T. Garner <kgarner@instructure.com>
This commit is contained in:
parent
ea8ad1330e
commit
3bb068bbe6
|
@ -70,6 +70,10 @@ class GradeSummaryAssignmentPresenter
|
|||
assignment.muted? || submission.nil?
|
||||
end
|
||||
|
||||
def original_points
|
||||
has_no_score_display? ? '' : submission.published_score
|
||||
end
|
||||
|
||||
def unchangeable?
|
||||
(!@summary.editable? || assignment.special_class)
|
||||
end
|
||||
|
|
|
@ -243,7 +243,7 @@
|
|||
<div style="display: none;">
|
||||
<!-- Store the original points so we don't need to parse and guess at locale -->
|
||||
<span class="original_points">
|
||||
<%= submission&.published_score %>
|
||||
<%= assignment_presenter.original_points %>
|
||||
</span>
|
||||
<!-- Store the original score so that we can retrieve it after any "What-If" calculations -->
|
||||
<span class="original_score">
|
||||
|
|
|
@ -81,4 +81,20 @@ describe GradeSummaryAssignmentPresenter do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "#original_points" do
|
||||
it "returns an empty string when assignment is muted" do
|
||||
@assignment.muted = true
|
||||
expect(presenter.original_points).to eq ''
|
||||
end
|
||||
|
||||
it "returns an empty string when submission is nil" do
|
||||
test_presenter = GradeSummaryAssignmentPresenter.new(summary, @student, @assignment, nil)
|
||||
expect(test_presenter.original_points).to eq ''
|
||||
end
|
||||
|
||||
it "returns the published score" do
|
||||
expect(presenter.original_points).to eq @submission.published_score
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue