What should happen when you backup a quiz using published categories from other courses?

What should happen when you backup a quiz using published categories from other courses?

by Tim Hunt -
Number of replies: 10
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
If you want all those questions included in the backup file, what do you think should happen when that file is restored?
Average of ratings: -
In reply to Tim Hunt

Re: What should happen when you backup a quiz using published categories from other courses?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
They should appear in the restored course, probably converted to new local categories.

My rationale is that the tutor will simply expect the actual quizzes not to break when the course is restored - even on a completely different site and we need to support that.

I would note though that there was quite a lot of strong feeling in some bug reports related to being able to export published categories. Some people thought that this was 'stealing' questions. I don't buy that, but you might want to consider it.
In reply to Tim Hunt

Re: What should happen when you backup a quiz using published categories from other courses?

by John Isner -
Hi Tim,
Two cases:

backup is restored on the same site
  • copy only references to published categories and questions
  • clone private categories and questions
backup restored on a different site
  • clone all questions and categories, published and private
Copying references (a.k.a. shallow copy) effectively allows sharing of quizzes at the site level, something I have always wished for.

I'm sure it's a lot more complicated or you wouldn't be asking smile
In reply to John Isner

Re: What should happen when you backup a quiz using published categories from other courses?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I would have thought that when restoring on the same site what you suggest is what happens now. I've not tried it though - is that not the case?
In reply to Howard Miller

Re: What should happen when you backup a quiz using published categories from other courses?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I don't actually know. I started looking at the code this afternoon, to try to fix MDL-4084, worked out how to get all the categories inluded in the backup, but then started asking what should happen on restore. Then I noticed that fortunately it was time to stop work, so I just posted in the forums and went go home and practice my contrabassoon.

(Well, sadly, it is not actually my contrabassoon, I am only borrowing it for a bit. But if anyone is in striking distance of here this Sunday afternoon, they can come and hear me endeavor to play it in Mahler's 4th Symphony.)
In reply to Tim Hunt

Re: What should happen when you backup a quiz using published categories from other courses?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Good luck with that Tim. You are too posh for me though. I just play the old bass guitar in the greatest rock and roll band in Scotland (well Motherwell anyway). Shameless plug - http://www.junction6.org (I'm the old guy with no hair)
In reply to Howard Miller

OTP: Junction 6

by Ray Lawrence -
Whoo! Busy schedule!
In reply to Ray Lawrence

Re: OTP: Junction 6

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Tell me... I'm starting to think it's my "proper" job and working at the University is just my second job smile
In reply to Howard Miller

Re: OTP: Junction 6

by Pierre Pichet -

This is the pleasure to be an almost retired professor working in an University that is migrating to Moodle. They are happy when you tell them (even my faculty dean) that you are working on Moodle code smile

Pierre

P.S. The dean was one of the principal leader to this move to Moodle!

In reply to John Isner

Re: What should happen when you backup a quiz using published categories from other courses?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
OK, what actually happens is this:

Categories are compared using the internal 'version stamp' which is a globally unique identifier like "example.com+061101171734+MkrENV". That is, "domainname+datetime+randombit".

If the category already exists in the course we are restoring to, we restore to that category.

Otherwise, if the category exists in another course, that other category is a published category, and if we have permission to restore questions into that other course, then we restore to that category.

Otherwise, we create a new (published) category in the current course, using the category name, etc. from the backup file, and restore to that.


It does a similar version stamp comparison when restoring each question.


So this all works as it should except that, if you restore a quiz to the same server, using question from a published category that you don't have the rights to restore to, then you will get a copy of the question. That is not easy to fix, so I won't change the existing behaviour now.
In reply to Tim Hunt

Re: What should happen when you backup a quiz using published categories from other courses?

by Ricardo Rodríguez García -
In my opinion this is what should happen

If the category already exists in the course we are restoring to, we restore to that category.

Otherwise, if the category exists in another course, that other category is a published category, and if we have permission to restore questions into that other course, then we restore to that category.

Otherwise, we create a new category in the current course, using the category name, etc. from the backup file, ask to the user if this new category will be published and restore to that.


It does a similar version stamp comparison when restoring each question.
so if the date or version of a cuestion is older than the actual question we should inform the user about that and ask to the user for a confirmation ginvin the option of repeat the answer for al the questions in the same state


So this all works as it should except that, if you restore a quiz to the same server, using question from a published category that you don't have the rights to restore to, then you will get a copy of the question.
if the version of the question in that category is diferent from the question in the backup we should inform the user about that and ask to the user if he/she want to get that question or create a local version of the question with the one in the backup