This PR adds the ability to dis-enroll users in the middle of the course.
This is done through a new CourseUserUpdater class implemented with that purpose. When a course user record is removed, then we need to take the following actions:
Remove course user wiki timeslices for deleted users.
Mark the course wiki timeslices records as needs_update if it includes any edit done by a deleted user. To determine this we run a query against article_course_timeslices table to get all the records where user_ids includes any deleted user. Based on that query, we get pairs of wikis and dates where the deleted users made some edits. Those are the course wiki timeslices that need to be updated as needs_update. In addition, the retrieved article course timeslices records have to be cleaned.
Remove articles courses records for articles courses that were only edited by deleted users. This is done through the ArticlesCoursesCleanerTimeslice.
This PR migrates course_wiki_timeslices table to add the new needs_update field. Now, before getting new revisions and updating new timeslices, we run a pre-update (where the CourseUserUpdater class is used). Then, we re-process all the timeslices marked as needs_update. After that, we fetch new data and process new timeslices.
Proposed flow:
Open questions and concerns
Note: while it's not mandatory, article course timeslices for deleted articles courses could be deleted too. The ArticlesCoursesCleanerTimeslice class itself could take care of that.
What this PR does
This PR adds the ability to dis-enroll users in the middle of the course.
This is done through a new
CourseUserUpdater
class implemented with that purpose. When a course user record is removed, then we need to take the following actions:needs_update
if it includes any edit done by a deleted user. To determine this we run a query againstarticle_course_timeslices
table to get all the records whereuser_ids
includes any deleted user. Based on that query, we get pairs of wikis and dates where the deleted users made some edits. Those are the course wiki timeslices that need to be updated asneeds_update
. In addition, the retrieved article course timeslices records have to be cleaned.ArticlesCoursesCleanerTimeslice
.This PR migrates
course_wiki_timeslices
table to add the newneeds_update
field. Now, before getting new revisions and updating new timeslices, we run a pre-update (where theCourseUserUpdater
class is used). Then, we re-process all the timeslices marked asneeds_update
. After that, we fetch new data and process new timeslices.Proposed flow:
Open questions and concerns
Note: while it's not mandatory, article course timeslices for deleted articles courses could be deleted too. The
ArticlesCoursesCleanerTimeslice
class itself could take care of that.