fix ability to set mastery paths after student in assign to tray

Closes LX-1850

Test Plan:

- Set up a course and enable Mastery Paths for the course
- Create an assignment.
- On the item assign to page, set the card to a student and save.
- go back to assign to and set the card to a mastery path and save
- go back to assign to and verify Mastery Paths is set
- toggle and try other mastery path/non-mastery path assignment on
  assign to tray.

Change-Id: I9c0de80b0fa99806c7af1e9af2a8cc6d0df52778
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/353837
Product-Review: Robin Kuss <rkuss@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Sarah Gerard <sarah.gerard@instructure.com>
QA-Review: Sarah Gerard <sarah.gerard@instructure.com>
This commit is contained in:
Robin Kuss 2024-07-29 14:17:08 -05:00
parent 9c133cf77e
commit 39d54a4166
2 changed files with 44 additions and 1 deletions

View File

@ -184,6 +184,48 @@ describe "wiki pages show page assign to" do
option_names = option_elements.map(&:text)
expect(option_names).to include("Mastery Paths")
end
it "allows mastery path to be re-assigned after a previous assignment to mastery paths and removal" do
@course.conditional_release = true
@course.save!
visit_wiki_page_view(@course.id, @page.title)
assign_to_btn.click
wait_for_assign_to_tray_spinner
keep_trying_until { expect(item_tray_exists?).to be_truthy }
click_delete_assign_to_item("Remove Everyone", 0)
select_module_item_assignee(0, "Mastery Paths")
click_save_button
keep_trying_until { expect(element_exists?(module_item_edit_tray_selector)).to be_falsey }
assign_to_btn.click
wait_for_assign_to_tray_spinner
keep_trying_until { expect(item_tray_exists?).to be_truthy }
click_delete_assign_to_item("Remove Mastery Paths", 0)
select_module_item_assignee(0, @student1.name)
click_save_button
keep_trying_until { expect(element_exists?(module_item_edit_tray_selector)).to be_falsey }
assign_to_btn.click
wait_for_assign_to_tray_spinner
keep_trying_until { expect(item_tray_exists?).to be_truthy }
click_delete_assign_to_item("Remove #{@student1.name}", 0)
select_module_item_assignee(0, "Mastery Paths")
click_save_button
keep_trying_until { expect(element_exists?(module_item_edit_tray_selector)).to be_falsey }
assign_to_btn.click
wait_for_assign_to_tray_spinner
keep_trying_until { expect(item_tray_exists?).to be_truthy }
expect(assign_to_in_tray("Remove Mastery Paths")[0]).to be_displayed
end
end
context "as a student" do

View File

@ -163,8 +163,9 @@ export const generateDateDetailsPayload = (
const masteryPathsCard = cards.find(card => card.selectedAssigneeIds.includes('mastery_paths'))
if (masteryPathsCard !== undefined) {
const isAlreadyMasteryPath = masteryPathsCard.defaultOptions?.[0]?.includes('Mastery Paths')
payload.assignment_overrides.push({
id: masteryPathsCard.overrideId,
id: isAlreadyMasteryPath ? masteryPathsCard.overrideId : undefined,
title: 'Mastery Paths',
due_at: masteryPathsCard.due_at || null,
unlock_at: masteryPathsCard.unlock_at || null,