[task_dispensers] Task settings migration #964
Closed
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.
This PR ends the long awaited process of task settings migration to task dispensers, first step to ease task sharing among courses.
As discussed with @nrybowski, the online but manual way was preferred to trigger the task file update. Therefore, a migration option is added in top of the task list page in case the current task dispenser detects legacy settings in the task files. When the upgrade is asked, the current task dispenser will import the task settings into its own data structure and then the fields imported will be removed from task file descriptors.
This is implemented by adding two function definitions to task dispensers :
has_legacy_tasks
andimport_legacy_tasks
as well as alegacy_fields
attribute to workaround the fact task dispensers have no access to the descriptors to modify the files themselves. A default newly defined task dispenser will inherit these definitions but they will have no effect on the tasks. They are purposely not defined as abstract methods then.