This PR adds support for updating course start and end dates. There are 4 main cases to take into account:
The start date changes to a later date. In that case, we need to remove course wiki, course user wiki and articles courses timeslices from the previous start date up until the new one. Additionally, if any articles were only edited during that period, we may need to remove their associated article courses, along with the timeslices for those articles throughout the entire course.
The start date changes to a previous date. In that case, we only need to create new course wiki and course user wiki timeslices from the new start date up until the previous start date. Timeslices for that period needs to be created as needs_update, so that the timeslices will be processed in the next update.
The end date changes to a later date. Similar to 2.
The end date changes to a previous date. Similar to 1.
Important behavior changes:
Before this PR, whenever the start date for a course gets updated, we set the course as 'needs_update' (see the course callback set_needs_update) . In the timeslice world, we want to do something less drastic. If the start date changes, we don't need to re-calculate the stats for the entire course, but we only need to mark the new first course timeslice as needs_update and add new timeslices (if the new start date is previous to the old one) or remove existing timeslices (if the new start date is later than the old one). Because of this, this PR replaces the set_needs_update course callback with a new set_needs_update_timeslice callback. This change broke the schedule_course_updates specs, which gets fixed in commit ae28c7d89b966935915e277e664f851a17a69b9e.
Prior to this PR, timeslices were created starting 3 days before the course start date to mitigate a previous issue where no timeslices were found for certain dates. This is not really necessary, so we reverted that behavior in this PR, and timeslices are now created right from the course start date.
Open questions and concerns
Changes are based on the start and end course fields. We don't take into account the timeline_start and timeline_end fields. Notice that if using the web-app to change the dates, we might need to update the timeline dates to make the start/end dates changes effective.
TODO in another PR: course scope ready_for_update should be updated to include courses that have at least one single timeslice with needs_update set to true.
TODO in another PR: we may need to analyse edge cases in pre-update where all start/end dates, wikis and users gets updated.
What this PR does
This PR adds support for updating course start and end dates. There are 4 main cases to take into account:
start
date changes to a later date. In that case, we need to remove course wiki, course user wiki and articles courses timeslices from the previous start date up until the new one. Additionally, if any articles were only edited during that period, we may need to remove their associated article courses, along with the timeslices for those articles throughout the entire course.start
date changes to a previous date. In that case, we only need to create new course wiki and course user wiki timeslices from the new start date up until the previous start date. Timeslices for that period needs to be created as needs_update, so that the timeslices will be processed in the next update.end
date changes to a later date. Similar to 2.end
date changes to a previous date. Similar to 1.Important behavior changes: Before this PR, whenever the start date for a course gets updated, we set the course as 'needs_update' (see the course callback
set_needs_update
) . In the timeslice world, we want to do something less drastic. If the start date changes, we don't need to re-calculate the stats for the entire course, but we only need to mark the new first course timeslice asneeds_update
and add new timeslices (if the new start date is previous to the old one) or remove existing timeslices (if the new start date is later than the old one). Because of this, this PR replaces theset_needs_update
course callback with a newset_needs_update_timeslice
callback. This change broke theschedule_course_updates
specs, which gets fixed in commit ae28c7d89b966935915e277e664f851a17a69b9e.Prior to this PR, timeslices were created starting 3 days before the course start date to mitigate a previous issue where no timeslices were found for certain dates. This is not really necessary, so we reverted that behavior in this PR, and timeslices are now created right from the course start date.
Open questions and concerns
start
andend
course fields. We don't take into account thetimeline_start
andtimeline_end
fields. Notice that if using the web-app to change the dates, we might need to update the timeline dates to make the start/end dates changes effective.ready_for_update
should be updated to include courses that have at least one single timeslice withneeds_update
set to true.