Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the LMSCourse backfill from grouping migration
The existing LMSCourse has two assumptions, with one unique index for each: - The same course (same authority_provided_id) can belong to multiple applications instances but we'll keep only one row in LMSCourse for it (unique h_authority_provided_id) - authority_provided_id is generated from guid, lti_context_id, then, those two columns should also be unique together. There's however a case when this is not true: - Applications instance with a null GUID launches and creates a course (None, CONTEXT_ID). This generates a hashed authority_provided_id. - The same application instance (ie, same row in ApplicationInstance) starts sending a GUID. We calculate a new (GUID, CONTEXT_ID) hash creating a new course, with a different authority_provided_id. When we join with ApplicationInstance for the backfill we only have the most recent GUID and we end up creating (GUID, CONTEXT_ID) duplicates. The solution is to exclude this type of duplicate, which is safe because this only happens on: - GUID changes from null to not null. We don't allow other value changes for GUID. - We only deduplicate courses when we have a newer version of the course, the older one can no longer be launched, the ApplicationInstance now has a GUID and it will sent along with every launch.
- Loading branch information