Assignments and classic quizzes will date shifting now become
an initial operation instead a late update to avoid
unnecessary lifecycle hook triggers.
refs CLAB-102
flag=pre_date_shift_for_assignment_importing
test plan:
# Setup
Create a course (SC) with:
- Assignment
- Quiz
- Graded Discussion
On all 3 set due date to a past date and other dates to something.
# With flag off (current behavior)
Create a new course
go to courses/{id}/content_migrations
use Copy a Canvas course
Source course should be SC
Select All content
Select Adjust events and due dates
Click remove dates
Import
Go to imported resources and verify that
due dates and other dates are gone.
Create a new course, do same import but
adjust dates instead of removing them.
Verify dates were adjusted as expected.
# With flag on
Enable pre_date_shift_for_assignment_importing
Create a new course
Test both scenarios of Adjust events and due dates
Expect same results
# Race condition
Ensure flag is on
Testing the race condition with SubmissionLifecycleManager
Create a new course
Create a student user, add to course, accept invite
in AssignmentImporter#try_to_save_with_date_shift
add "binding.irb" on line 607
open terminal
cd canvas-lms
docker compose stop jobs
docker compose run jobs (do the same in another terminal)
bundle exec script/delayed_job run (in both shells)
Import SC into new course
one of the job processes will pick up the job
and give you an irb
"item.save_without_broadcasting"
"SubmissionLifecycleManager.recompute(item)"
"item.submissions" should be empty or should have no graded subs
Change-Id: Ide39a552b625c099c0c87fc6166cd9bd37a0ab15
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/357178
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rajmund Csehil <rajmund.csehil@instructure.com>
QA-Review: Rajmund Csehil <rajmund.csehil@instructure.com>
Product-Review: Rajmund Csehil <rajmund.csehil@instructure.com>
QA-Review: Ferenc Marcsó <ferenc.marcso@instructure.com>