Updating and replacing questions on import

Updating and replacing questions on import

by Moshe Kamensky -
Number of replies: 5

Hi,


This is on the same topic as [this discussion](https://moodle.org/mod/forum/discuss.php?d=310251), which was archived. I was wondering if there was any progress on this since then. To recap: I would like to export questions from moodle (preferably in Moodle XML), edit and/or add, then import back without duplicates, updating the question if changes were made. If updating is too complicated, I'd rather have them rejected than creating duplicates.


Thanks,

Moshe

Average of ratings: -
In reply to Moshe Kamensky

Re: Updating and replacing questions on import

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
No progress. It is still a lovely idea, but no one has had time to work on it.
In reply to Tim Hunt

Re: Updating and replacing questions on import

by Moshe Kamensky -
Thanks. I have no experience with the moodle code (or php), but I might try to implement, I guess it should not be too difficult. In terms of the interface, I guess the cheapest way would be to export the DB id of the question, and then use it when importing back. Are there any downsides to this? By the way, the questions have an `id number` field that I thought would be used for this purpose (and which is exported), but it does not seem to do anything like that, what is its purpose? Would that be a good way to sync?
In reply to Moshe Kamensky

Re: Updating and replacing questions on import

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, the biggest thing to worry about implementing this is:

if you are going to overwrite existing data on import, then you need to work out how you are going to prevent accidental or malicious disasters where a whole lot of the wrong data is destroyed.
In reply to Tim Hunt

Re: Updating and replacing questions on import

by Moshe Kamensky -
I wasn't planning to worry about it: malicious should be taken care of elsewhere (gaining unauthorized action to mass change should be viewed as bad as for one change, I think), and accidental is up to the user... One could add some confirmation dialog, etc., I guess, but that's an extra feature.

By the way, a bit of topic for the original question, but related to this: Is there a (web) api for Moodle (via json or something like this)? I didn't find any. Thanks!