Can I update all instances of a copied course simultaneously when I make changes to the original course?

Can I update all instances of a copied course simultaneously when I make changes to the original course?

by Gloria C -
Number of replies: 5

I have an original course that I copied for use in multiple locations. I want to know if it's possible to update all the copied versions at once when I make changes to the original course, rather than having to update each copied course individually. This would help streamline the process as the course content evolves over time.

Based on my research, I’m aware of the concept called Course Meta Link, but it seems to be more related to course enrollment rather than course content. Course Meta Link primarily handles the enrollment of students across multiple sections rather than synchronizing updates to course materials.

Any ideas would be appreciated even though the answer may be "no it is no possible for now" smile

Thanks

Average of ratings: -
In reply to Gloria C

Re: Can I update all instances of a copied course simultaneously when I make changes to the original course?

by Davo Smith -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
I'm not aware of anything that would do what you want - it would likely be very complicated to implement.

For every change in the parent course, it would have to encode that change in some way and then apply it to the child courses, attempting to merge the change with any other changes that had been made in the child course. To do this, it would need to a) figure out how to match activities from the first to the second course (what if the activities are in a different order in the child course; what if one of them has had its name changed; what if there is a new activity added or one of the activities has been deleted?), b) figure out which differences are the result of changes in the parent course (so should be overwritten) and which are due to changes made in the child course (presumably, those should not be overwritten).

There is also the question about the scope of the changes to merge - e.g. if a teacher adds a new discussion to a forum in the parent course, should that be merged (some teachers might consider the starting discussions a key part of the configuration to be transferred, others wouldn't)? What about posts from students? The same questions could be asked of glossary entries, wiki pages, or any other activities that involve collaboration (rather than a clear teacher / student distinction).
Average of ratings: Useful (1)
In reply to Davo Smith

Re: Can I update all instances of a copied course simultaneously when I make changes to the original course?

by Gloria C -
I don't think this task is particularly complex to implement.

Essentially, it requires adding a field to the database: specifically, a foreign key in the subcourse table that references the parent_course_id. This establishes a 1-to-many relationship where one parent course can have multiple child courses.
To manage synchronization, we could use flags in the activity tables. However, given that course content typically does not change frequently, this might not be necessary.
Instead, we could introduce a field called sync_change_to_child_course_content (just for an example). If this field is set to true, updates to the parent course will be reflected in the child courses. If set to false, changes to the parent course will not affect the children. Changes include create, update, and delete of course.
In reply to Gloria C

Re: Can I update all instances of a copied course simultaneously when I make changes to the original course?

by Davo Smith -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
To clarify my original point a little.

We have course A with a forum called "My forum", that is set to grade using the "Highest grade" method.

We have course B which is a copy of this course.

At some point, we switch the grading method for the forum in course B to "Average grade".

We then change the name of the forum in course A to "My renamed forum".

What should the outcome be in course B? Do we expect the forum in course B to have the name changed to "My renamed forum" and the grade method reset to "Highest grade"? Or do we expect just the name to be changed?

If we only expect the name to change, then we suddenly need to introduce a lot more fine-grained tracking of exactly what has been changed; at the moment, when you edit the settings on a forum activity, the full settings from the form are written into the database, no attempt is made to track which ones have changed.

Even if we did have this fine-grained tracking, what happens if the forum in course B had been independently renamed to "A new forum name" - what do we do then? Do we just overwrite this with the new name from course A? Do we refuse to overwrite, because we've changed it manually in course B? (If the latter, then we need to keep track of which differences are because course A has changed and which are because course B has changed).

For that matter, how do we even know, if we edit a forum in course A, which of the forums in course B is the one we want to update? We could introduce a new field somewhere to link the forum in course B with the forum it was created from (during the initial backup and restore). This wouldn't be particularly difficult to do, but the complexity quickly multiplies up as we go on.

What about if we duplicate an activity in course B - is that duplicated activity still marked as created from the original activity in course A (so both of the copies in course B get updated when course A changes), or is that duplicated activity completely separate? What about if the activity is deleted in course A - should the activity (and all the user data) get deleted without warning in course B (and what about the duplicate we created from it in course B - does that go as well)?

That's just a single example - many activities have more complex settings which might be spread across multiple database tables (e.g. the "database" activity, where the configuration extends to the list of fields and the display templates) - we'd probably need to extend every activity to manage the tracking of the changes within itself.

This is all before we start getting into activities where there is an unclear boundary between configuration and user data - for example a wiki: if a teacher edits a wiki page in course A, should that be replicated to course B? If so, how do we merge that with any changes made by users (either students or teachers) on course B? Do we just overwrite, or do we have to find some way to merge the change history?

What happens if we create course C from course B - do the changes from course A need to replicate all the way down to course C as well?

I know that many of these issues I've highlighted may have really simple or obvious solutions that will cover 90% of the use cases, but if such a feature was ever actually rolled out, it would need to handle those awkward 10% of cases in a clear, transparent way, that doesn't lead to unexpected overwriting of data.

I'm not saying this is impossible to do - clearly there are solutions to every one of the points I've raised; but there is still a lot more to it than simply having a flag that says 'replicate all course changes to course X'.
Average of ratings: Useful (2)
In reply to Gloria C

Re: Can I update all instances of a copied course simultaneously when I make changes to the original course?

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
When Moodle is installed no primary foreign key relationships are installed in the database. See my notes here
https://www.examulator.com/er/
In reply to Gloria C

Re: Can I update all instances of a copied course simultaneously when I make changes to the original course?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
This conflict is very common and the cause is surprisingly simple. It lies in the difference between how courses are understood by many teachers and what courses are in Moodle. Whereas courses in Moodle are the sum of their material and all the activities during the course including data on all the interactions - student-material, student-teacher and student-student - for those teaches courses are only the course material.
 
One of its consequences is what we have here, teachers believing a course can be updated any time - before, during or after the course ran. There we have the mnemonic, "a course runs". Each run is unique!
 
The developers can't do much about it. That is how courses are defined in Moodle. See Courses.
wink