Propagate hide points/results
closes OUT-2138 test plan: - create a course level outcome - in the course, create an assignment with a rubric containing the outcome as a criterion - in the rails console, set the hide attributes on the rubric association: > RubricAssociation.last.update(hide_points: true, hide_outcome_results: true) - as a student, submit to the assignment - as a teacher, grade the assignment in speedgrader, giving points to the outcome in the rubrics - in the rails console, confirm the attribute values were propagated (all should be `true`): > RubricAssessment.last.hide_points > LearningOutcomeResult.last.hide_points > LearningOutcomeResult.last.hidden Change-Id: If3bd30a22973fdb7a6b4bdea171f050a4a7bdeab Reviewed-on: https://gerrit.instructure.com/147699 Reviewed-by: Michael Brewer-Davis <mbd@instructure.com> Reviewed-by: Frank Murphy <fmurphy@instructure.com> Reviewed-by: Rob Orton <rob@instructure.com> QA-Review: Dariusz Dzien <ddzien@instructure.com> Tested-by: Jenkins Product-Review: Michael Brewer-Davis <mbd@instructure.com>
This commit is contained in:
parent
6cce67989b
commit
798e2a0700
|
@ -103,7 +103,11 @@ class RubricAssessment < ActiveRecord::Base
|
|||
# title
|
||||
result.title = "#{user.name}, #{rubric_association.title}"
|
||||
|
||||
result.assessed_at = Time.now
|
||||
# non-scoring rubrics
|
||||
result.hide_points = self.hide_points
|
||||
result.hidden = self.rubric_association.hide_outcome_results
|
||||
|
||||
result.assessed_at = Time.zone.now
|
||||
result.save_to_version(result.attempt)
|
||||
result
|
||||
end
|
||||
|
|
|
@ -327,6 +327,7 @@ class RubricAssociation < ActiveRecord::Base
|
|||
assessment.data = ratings if replace_ratings
|
||||
|
||||
assessment.set_graded_anonymously if opts[:graded_anonymously]
|
||||
assessment.hide_points = association.hide_points
|
||||
assessment.save
|
||||
if artifact.is_a?(ModeratedGrading::ProvisionalGrade)
|
||||
artifact.submission.touch
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# Copyright (C) 2018 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
class AddHidePointsToRubricAssessments < ActiveRecord::Migration[5.1]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :rubric_assessments, :hide_points, :boolean
|
||||
change_column_default(:rubric_assessments, :hide_points, false)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# Copyright (C) 2018 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
class AddHidePointsToLearningOutcomeResults < ActiveRecord::Migration[5.1]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :learning_outcome_results, :hide_points, :boolean
|
||||
change_column_default(:learning_outcome_results, :hide_points, false)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# Copyright (C) 2018 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
class AddHiddenToLearningOutcomeResults < ActiveRecord::Migration[5.1]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :learning_outcome_results, :hidden, :boolean
|
||||
change_column_default(:learning_outcome_results, :hidden, false)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# Copyright (C) 2018 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
class BackfillHidePointsToRubricAssessments < ActiveRecord::Migration[5.1]
|
||||
tag :postdeploy
|
||||
|
||||
def up
|
||||
DataFixup::BackfillNulls.send_later_if_production_enqueue_args(
|
||||
:run,
|
||||
{priority: Delayed::LOW_PRIORITY, n_strand: 'long_datafixups'},
|
||||
RubricAssessment,
|
||||
{
|
||||
hide_points: false
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,33 @@
|
|||
#
|
||||
# Copyright (C) 2018 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
class BackfillHidePointsAndHiddenToLearningOutcomeResults < ActiveRecord::Migration[5.1]
|
||||
tag :postdeploy
|
||||
|
||||
def up
|
||||
DataFixup::BackfillNulls.send_later_if_production_enqueue_args(
|
||||
:run,
|
||||
{priority: Delayed::LOW_PRIORITY, n_strand: 'long_datafixups'},
|
||||
LearningOutcomeResult,
|
||||
{
|
||||
hide_points: false,
|
||||
hidden: false
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
|
@ -199,8 +199,43 @@ describe RubricAssessment do
|
|||
}
|
||||
}
|
||||
})
|
||||
expect(assessment.score).to eql(5.0)
|
||||
expect(assessment.artifact.score).to eql(5.0)
|
||||
expect(assessment.score).to be 5.0
|
||||
expect(assessment.artifact.score).to be 5.0
|
||||
end
|
||||
|
||||
it "propagates hide_points value" do
|
||||
@association.update!(hide_points: true)
|
||||
criterion_id = "criterion_#{@rubric.data[0][:id]}".to_sym
|
||||
assessment = @association.assess({
|
||||
:user => @student,
|
||||
:assessor => @teacher,
|
||||
:artifact => @assignment.find_or_create_submission(@student),
|
||||
:assessment => {
|
||||
:assessment_type => 'grading',
|
||||
criterion_id => {
|
||||
:points => "3"
|
||||
}
|
||||
}
|
||||
})
|
||||
expect(assessment.hide_points).to be true
|
||||
expect(LearningOutcomeResult.last.hide_points).to be true
|
||||
end
|
||||
|
||||
it "propagates hide_outcome_results value" do
|
||||
@association.update!(hide_outcome_results: true)
|
||||
criterion_id = "criterion_#{@rubric.data[0][:id]}".to_sym
|
||||
@association.assess({
|
||||
:user => @student,
|
||||
:assessor => @teacher,
|
||||
:artifact => @assignment.find_or_create_submission(@student),
|
||||
:assessment => {
|
||||
:assessment_type => 'grading',
|
||||
criterion_id => {
|
||||
:points => "3"
|
||||
}
|
||||
}
|
||||
})
|
||||
expect(LearningOutcomeResult.last.hidden).to be true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -258,5 +258,12 @@ describe RubricAssociation do
|
|||
expect(assessment.assessor).to eq(second_teacher)
|
||||
expect(submission.grader).to eq(second_teacher)
|
||||
end
|
||||
|
||||
it "propagated hide_points value" do
|
||||
rubric_association.update!(hide_points: true)
|
||||
assessment = rubric_association.assess(user: student, assessor: first_teacher, artifact: submission,
|
||||
assessment: assessment_params)
|
||||
expect(assessment.hide_points).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue