Call SLM when updating module overrides
closes LF-685 flag = differentiated_modules Test plan: - Create a module with at least 1 assignment - In a rails console, call: `assignment.submissions.reload.pluck(:user_id)` - Expect to see the ID for each student in the course - Add an override to the module - Make the same call in the rails console - Expect to see only the IDs of the students targeted by the module override Change-Id: I9faf8f1b4d1a2bb3f89290915b2b878f5d7d0c19 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/339076 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Sarah Gerard <sarah.gerard@instructure.com> Reviewed-by: Robin Kuss <rkuss@instructure.com> QA-Review: Sarah Gerard <sarah.gerard@instructure.com> QA-Review: Robin Kuss <rkuss@instructure.com> Product-Review: Jackson Howe <jackson.howe@instructure.com>
This commit is contained in:
parent
39191a3ccc
commit
b99a36dd08
|
@ -171,6 +171,7 @@ class ModuleAssignmentOverridesController < ApplicationController
|
|||
delete_existing_overrides(override_ids_to_delete)
|
||||
update_existing_overrides(overrides_to_update)
|
||||
create_new_overrides(overrides_to_create)
|
||||
@context_module.update_assignment_submissions
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ class ContextModule < ActiveRecord::Base
|
|||
ContentTag.where(context_module_id: self).where.not(workflow_state: "deleted").update(workflow_state: "deleted", updated_at: deleted_at)
|
||||
delay_if_production(n_strand: "context_module_update_downstreams", priority: Delayed::LOW_PRIORITY).update_downstreams
|
||||
save!
|
||||
update_assignment_submissions(module_assignments_quizzes)
|
||||
update_assignment_submissions(module_assignments_quizzes) if assignment_overrides.active.exists?
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -987,8 +987,8 @@ class ContextModule < ActiveRecord::Base
|
|||
assignment_overrides
|
||||
end
|
||||
|
||||
def update_assignment_submissions(module_assignments_quizzes)
|
||||
if Account.site_admin.feature_enabled?(:differentiated_modules) && assignment_overrides.active.exists?
|
||||
def update_assignment_submissions(module_assignments_quizzes = current_assignments_and_quizzes)
|
||||
if Account.site_admin.feature_enabled?(:differentiated_modules)
|
||||
SubmissionLifecycleManager.recompute_course(context, assignments: module_assignments_quizzes, update_grades: true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -233,6 +233,19 @@ describe ModuleAssignmentOverridesController do
|
|||
expect(@module1.assignment_override_students.reload.to_a).to eq students
|
||||
end
|
||||
|
||||
it "updates the module's assignment submissions" do
|
||||
assignment = @course.assignments.create!(title: "Assignment", points_possible: 10)
|
||||
@module1.add_item(assignment)
|
||||
@module1.update_assignment_submissions
|
||||
expect(assignment.submissions.reload.pluck(:user_id)).to contain_exactly(@student1.id, @student2.id, @student3.id)
|
||||
|
||||
put :bulk_update, params: { course_id: @course.id,
|
||||
context_module_id: @module1.id,
|
||||
overrides: [{ "id" => @adhoc_override2.id, "student_ids" => [@student3.id] }] }
|
||||
expect(response).to have_http_status :no_content
|
||||
expect(assignment.submissions.reload.pluck(:user_id)).to contain_exactly(@student3.id)
|
||||
end
|
||||
|
||||
it "returns 400 if the overrides parameter is not a list" do
|
||||
put :bulk_update, params: { course_id: @course.id, context_module_id: @module1.id, overrides: "hello" }
|
||||
expect(response).to be_bad_request
|
||||
|
|
Loading…
Reference in New Issue