openstax/tutor-server

Duplicate tasks when importing multiple students (spreadsheet)

Dantemss opened this issue · 0 comments

The spreadsheet import eventually calls CourseMembership::AddEnrollment once for each student

Each call to that routine will create a job that runs ReassignPublishedPeriodTaskPlans, resulting in potentially multiple Tasks for each TaskPlan for each student.

To fix, do both:

  1. Use serializable isolation and/or advisory locks to prevent multiple instances of ReassignPublishedPeriodTaskPlans from running on the same period at the same time.
  2. Make the spreadsheet import only call ReassignPublishedPeriodTaskPlans once, at the end.