[Data rearchitecture] ArticleScopedProgram/VisitingScholarship: Handle changes in categories and assignments #6107
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
This PR addresses several changes in order to deal with updates in categories and assignments for
ArticleScopedProgram
andVisitingScholarship
course types.On one hand, the
ConstantUpdate
class invokesAssignmentUpdater.update_assignment_article_ids_and_titles
with the following description:This means we need article records for every article, not just the scoped ones. As a result, this PR modifies how revisions are filtered (through
course.filter_revisions
) and ensures that article records are always created, even for non-scoped articles.Create article course timeslice records for every revision
Assignments can be added or removed at any point in the course. In addition, categories may change even without any user action, as one article may be added or removed from a category independently. To handle this changes in an easier way, article course timeslices are created for every revision (even for those not associated to a scoped article).
Implement
UpdateTimeslicesScopedArticle
classThis new class handles changes in assignments and categories, and put some timeslices to re-process. Only for article scoped program or visiting scholarship courses.
Open questions and concerns
TODO: this PR users the (not used)
views
Revision field to specify if a given revision is scoped or not. We should change this to something more meaningful when deleting Revision code.