keep quiz assignment group in sync when dragging on assignment index
test plan: - create two quizzes in separate assignment groups - on the assignments index page, drag a quiz into a different assignment group - go to the quiz page and ensure the assignment group shown is up to date fixes CNVS-39620 Change-Id: I639aa19b37e08fc63b91fa295db4ff575c4e48f4
This commit is contained in:
parent
e1d4b3ee4d
commit
922bb56674
|
@ -166,6 +166,7 @@ class AssignmentGroupsController < ApplicationController
|
|||
return render_unauthorized_action unless can_reorder_assignments?(assignments, @group)
|
||||
|
||||
assignments.update_all(assignment_group_id: @group.id)
|
||||
@context.active_quizzes.where(assignment_id: order).update_all(assignment_group_id: @group.id)
|
||||
@group.assignments.first.update_order(order) unless @group.assignments.empty?
|
||||
groups = AssignmentGroup.where(id: group_ids)
|
||||
groups.touch_all
|
||||
|
|
|
@ -352,6 +352,16 @@ describe AssignmentGroupsController do
|
|||
expect(@group1.assignments.count).to eq(3)
|
||||
end
|
||||
|
||||
it 'moves an associated Quiz to the correct assignment group along with the assignment' do
|
||||
@quiz = @course.quizzes.create!(title: 'teh quiz', quiz_type: 'assignment', assignment_group_id: @group2)
|
||||
user_session(@teacher)
|
||||
post :reorder_assignments, params: {course_id: @course.id, assignment_group_id: @group1.id,
|
||||
order: @order + ",#{@quiz.assignment.id}" }
|
||||
@quiz.reload
|
||||
expect(@quiz.assignment.assignment_group_id).to eq(@group1.id)
|
||||
expect(@quiz.assignment_group_id).to eq(@group1.id)
|
||||
end
|
||||
|
||||
context 'with grading periods' do
|
||||
before :once do
|
||||
group = Factories::GradingPeriodGroupHelper.new.create_for_account(@course.root_account)
|
||||
|
|
Loading…
Reference in New Issue