Importing one quiz imports all questions

Importing one quiz imports all questions

by Morten Brydensholt -
Number of replies: 26

1.8+

If I import one quiz from a course into another, I end up importing all the questions and categories and the corresponding resources from the course I import from.

Is there a way to stop this pathological behaviour of the import function?

Best regards

Morten

Average of ratings: Useful (1)
In reply to Morten Brydensholt

Re: Importing one quiz imports all questions

by Max Wild -
Yes, I would like the answer to that one as well
Regards
Maxwell Wild
Manchester High School for Girls
In reply to Morten Brydensholt

Re: Importing one quiz imports all questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Morten - You can prevent the files from coming over by telling the import not to bring the course files; however, the only way for the quiz to work is if it brings the questions over. I have not played to see how this might work in Moodle 1.9 (not yet released except for beta testing) where the questions are handled differently. I know that a great deal of work was done to improve the sharing of questions in 1.9; however, I'm not sure how imports handle the questions. Peace - Anthony
In reply to Anthony Borrow

Ang: Re: Importing one quiz imports all questions

by Morten Brydensholt -

Anthony,

I want the questions to go with the quiz. However I don't want to import ALL questions and ALL categories.

Besides I have difficulties deleting the not-wanted categories after an import (after deletion of the not-wanted questions). So far I have been forced to delete them manually from the database.

I can live with the import of ALL the course files as this is the safe way for linked materials to work.

Morten

In reply to Morten Brydensholt

Re: Ang: Re: Importing one quiz imports all questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Morten - It is also the safe way for questions and quizzes. How else could you ensure that a quiz with random questions in it will work. Essentially you need to bring over all of the questions just like you would bring over all of the files to ensure that the resources work. While I do not think that this is ideal there is a method to the madness. As I said, this may change in Moodle 1.9 but for now that is what we have. Personally I would avoid manually deleting them from the database. How is having them there problematic? Perhaps that might help us work toward understanding how we can best avoid that problem. Peace - Anthony
In reply to Anthony Borrow

Ang: Re: Ang: Re: Importing one quiz imports all questions

by Morten Brydensholt -

Thanks Anthony,

I can see the underlying thinking of this mass import.

But this is what I experience: 

I import one quiz from course A to course B and then one quiz from course B to course C.

Then course C contains all questions, categories and resource files from course A and B. Most of them are not wanted and we are talking 800 not wanted questions in 40 categories and a lot of files and folders.

I end of having every course containing every other course.

On top of that I'm not able to delete the unwanted categories using the 'Edit categories' interface (after deleting the questions). I get a warning message saying the categori has questions in it (telling me to move the questions first). That is why I have to manually delete these empty categories directly from the database's mdl_question_categories.

Besides my fellow teachers complain that they cannot edit some of the imported questions as they belong to the originator.

So something unhealthy happened to my database during these backup's and restore's during the last month.

The safe way seems to be:

1. Export the wanted questions to the desktop as MoodleXML including the categories (tick the 'to file').

2. Open just that one file in a text editor, and do a FindAndReplace to replace all occurrences of course related resource links like "http://mydomain.com/file.php/32/". Substitute '32' with the course number for the destination course.

3. Make a zip file of the wanted resourse files. Download this to the desktop.

4. Upload and unpack the zip file to the file system of the destination course.

5. Import the questions including the categories (tick the 'to file') into the destination course.

6. Author new quizzes using the imported questions.

Best regards

Morten

In reply to Morten Brydensholt

Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Morten - Back before the question code was re-written for 1.9 I was facing similar issues with quizzes. I wanted to be able to import pieces. I'll have to play and see how things are currently being imported. As I understood it (in Moodle 1.8) I thought that only the categories that are used in a quiz are imported when doing an import (but I could be wrong about that). The goal of the import was to make it so that it would only pull in those resources and activities that you wanted and thus encourage sharing. There is definitely some room here from improvement. Your approach of exporting the desired questions to XML seems like a good work around; however, I would encourage you to add an issue to the tracker as an improvement detailing how you would like for the importing of a quiz to be better handled. I'll continue to give it some thought and play with what is happening in Moodle 1.9. Could you describe in a little more detail what you would consider to be the ideal situation? Thanks - Anthony
In reply to Anthony Borrow

Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Morten Brydensholt -

Anthony,

The ideal situation is actually what is promised by the import page. You put a check mark on the material you want to be imported.

So if I want to import a quiz then the relevant questions and the category should go with it (ignore import of quizzes with random questions). The questions should also belong to the destination course and thus be editable. If the category allready exist no new identical category should be created. Also only the linked resources in the relevant questions should be imported and the questions relinked. If the source folder and the destination folder in the file system are identical then the resourse files should be put in the existing destination folder (and not rejected).

So what you see is what you get, no more no less.

Something very severe happened to the backup and restore system early september so I cannot say my Moodle sites are acting properly anymore. Others might say everything is smooth and perfect with the import facility.

I tried to import a quiz yesterday. The quiz itself had 8 questions and the source course 38 questions all in all. So I expected the import to bring the quiz and 38 questions (among them 8 relevant). But it imported over 200 questions of which a lot of dublicates.

How do you delete dublicate entries in the database?

Is migrating to 1.9 safe at this point? It might cure my databases.

Best regards

Morten

Average of ratings: Useful (1)
In reply to Morten Brydensholt

Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Thanks for explaining what you are looking for. I will see if I can figure out what is happening. In the meantime, I would say that 1.9 is anything but safe at this point although a lot of work is going in to make it better. I'd wait until it is released before trying anything. Peace - Anthony
In reply to Morten Brydensholt

Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Morten - I'm going back and starting to catch up on issues that were in my followup folder. I know it has been a while; however, as I re-look at this I think that users will expect the import of a quiz to work regardless of whether they have random questions or not. As a result, the approach to bring in all of the questions seems at this point in the development of things to be a prudent. Jamie mentioned that there is much better control for Moodle 1.9 which although not yet released is still reasonably stable (IMHO). I think this is one of those areas where it may well be impossible to accommodate every user. It seems like a situation where we want our cake and to be able to eat it too. By that I mean that we want the ability to import the quizzes and have the imported quiz work and yet not have duplication and keep the database entries and questions manageable. I suspect that we will just have to live with that tension for now. Peace - Anthony
In reply to Anthony Borrow

Ang: Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Morten Brydensholt -

Hi Anthony

I acknowledge with thanks your hard work on the quiz import feature. And I look forward to see if you can fix some of the bad consequencies from importing quizzes.

Until now I have begged my Moodle users not to import quizzes when they want to share or reuse quizzes. I have spent endless hours on cleaning question banks and files in courses after import of a few quizzes.

So I ask you politely to reconsider your strategy. What is the benefit of being able to import one random quiz if you know you'll later have to remove 800 questions and 40 categories from the question bank and 300 files from the file system in 20 folders?

But if I got your message wrong please do correct me.
And surely you cannot make everybody happy - choices have to be made.

Best regards

Morten

Average of ratings: Useful (1)
In reply to Morten Brydensholt

Re: Ang: Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Morten,

Ultimately the choice is not mine. Tim Hunt maintains the quiz module and others work on helping with the question banks. On the production server I use, I have not had to delete questions or other folders or files from doing imports. Typically the way I have used imports is to import all the quizzes I need from another course into mine. I found that it is actually good to have another copy of the questions in cases where I wanted to give partial credit to a question after students have argued their point or explained why the material was not presented as clearly as it could have been. I figure they learn from the process of making their argument and I recognize that by giving some partial credit which other teachers may not want to do or agree with. The disadvantage is that I have to take responsibility for the content in my course and maintain that course's question bank and cannot benefit from having others help me to maintain it (something you can accomplish in Moodle 1.9 by using a course category bank of questions - as I understand it since I've not actually done this on a production site).

The benefit of being able to import a random quiz is simply what it computer science terms is referred to as completeness. The approach that Tim and the other developers took with Moodle 1.8 was to allow all quizzes to be importable. To do so, they needed to bring over all of the questions to be able to handle random quizzes. Since Moodle 1.8 is a stable release it is highly unlikely and I would not encourage it that there will be a major change that would effect the way that it works. Instead, we look forward to how we would like it to be. I first started thinking about this because I wanted what you want - namely - the ability to have one question bank that multiple teachers use and I did not like the way that questions were imported.

I think you got my message right, but realistically I do not see any of the developers putting in time to work on a patch to Moodle 1.8 to change the behavior. Of course, you are free to do so or contract for such a customization. I'm not sure how others have handled the situation. I learned to live with it as it was and it seemed to work out OK. One thing that might help is to import all the quizzes at once so that you do not get multiple versions of the same categories. I can see where that would be rather confusing and annoying. If I get a chance (and the odds are probably 50-50 just to be realistic about it) I will try to look at the code and see if there might be some improvements that could be made without affecting the completeness of the solution. I know this is probably not what you want to hear but I don't want to spread false hopes either. Feel free to send me a periodic friendly Moodler message reminder on this or to continue to flush out the behavior that you believe to be ideal that would simultaneously be able to ensure that all quizzes (including random quizzes) can be imported. Thanks for being part of the Moodle community.

Peace - Anthony
In reply to Anthony Borrow

Ang: Re: Ang: Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Morten Brydensholt -

Hi Anthony

Don't get me wrong - I'm totally happy with the import function when one wants to import 'the whole Monty'. We use that a lot with great success smile

But I also do get mails from frustrated Moodle teachers because of their question banks getting messy after sharing quizzes.

One word about this: I'm trying to convince decision makers in Denmark to use Moodle as the platform for e-learning in the gyms. So we have brought 5 gyms together to test Moodle for its ability to intercooperate and share stuff among mainly math and physics teachers. The goal is to produce enough material all together so that this material can be spread to 25 gyms next summer and tested among other teachers who don't necessarily know how to edit questions and quizzes in the first place.

As you can imagine math and physics teachers use media files a lot, so sharing by exporting questions in categories with missing files and broken links to the desktop is not the smoothest method to use.

And cleaning the question bank and file system after an import is unfortunate also out of the question.

So let me try this proposal on importing quizzes (which someone else proposed): Check if any quizzes contains random quizzes. If so import everything like today. If not only import the wanted stuff.
Easy to ask for, but maybe hard to implement...

However it seems as a solution without loss of completeness.

Best regards

Morten

In reply to Morten Brydensholt

Re: Ang: Re: Ang: Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Morten - I am not unsympathetic to the challenge and your proposal seems to be a reasonable request. Although I think most of the energy is being directed toward moving forward with Moodle 1.9 and beyond. In any case, I would like to see us review what is happening to see if we might be a little more efficient. I remember in previous conversations about how best to manage questions that it was felt that GIFT represented a great way to store the master questions and teacher could import questions from those files where each gift file would contain a category. Perhaps you are right in discouraging the use of import as it seems to be causing more hassle than it is worth. Nevertheless, if I am importing a single quiz on Chapter 1 and the quiz only uses questions from that category I really do not expect the other questions to be imported (random or not). So that is what I would like to see happen. To that end, would you be willing to create an issue in the tracker as an improvement for Moodle 1.8 with a request to review the code and see if we can improve things there? Also, reference the discussion thread and post the tracker number here in the forum so others can vote on it if they choose. Thanks and Peace - Anthony
In reply to Anthony Borrow

Ang: Re: Ang: Re: Ang: Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Morten Brydensholt -

Anthony,

Working on 1.9 is fine with me. And I believe this issue http://tracker.moodle.org/browse/MDL-12403 in the Tracker covers the same request.
Importing only the categories in use by the questions in the quizzes would indeed be a perfect workaround.

Thanks

Morten

In reply to Morten Brydensholt

Re Importing one quiz imports all questions

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Morten > So let me try this proposal on importing quizzes (which someone else proposed): Check if any quizzes contains random quizzes. If so import everything like today. If not only import the wanted stuff.

I totaly agree with this proposal. It makes perfect sense. Since I never ever use random questions myself, I am quite frustrated at the way the quiz import works at the moment, with hundreds of unwanted questions being imported.

Joseph

EDIT.- Actually, I had already proposed this solution in my Sunday, 23 September 2007 post!approve

In reply to Joseph Rézeau

Ang: Re Importing one quiz imports all questions

by Morten Brydensholt -

EDIT.- Actually, I had already proposed this solution in my Sunday, 23 September 2007 post!

Hehe - I couldn't find your post when referring to it. Didn't think of looking two posts down smile

Morten

In reply to Anthony Borrow

Re: Ang: Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
To be honest, I don't think very much thought went into this particular combination of features. That is the combination of the code that ensures, when you backup a course, that you get all the necessary questions; with the code that lets you selectively backup only part of a course.

In the past, we have just ensured that it worked, not that it worked well, or in the best possible way. What Morten is suggesting is a good idea. But, of course the code as it currently is basically works, and so there other bug reports probably have to take priority over this. Still, we will probably get around to fixing this one day. I am glad to see there is an issue in the tracker.
In reply to Tim Hunt

Re: Ang: Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Anil Sharma -
With the moodle 1.9, we hoped this issue would be sorted but its become more complicated. To migrate from 1.8 to 1.9, all categories and questions land up in different courses and sometimes, there is a restore error because of categories.

I think it is more urgent to resolve this issue than to make any new feature or changes to the quiz system - the mode code that is developed before changing this - the more of it will have to be edited later.

I've voted for this issue and also created a subtask to look into quiz restoration between 1.8 and 1.9 moodles
In reply to Morten Brydensholt

Re: Ang: Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Louis Fleming -
Morten

I share questions between courses with nowhere near this problem.

When I create a bank of questions that I know are needed in more than one course, at the point of creating a category for them - turn the publish to yes and the category and its questions are visible in other courses.

In the other course, I do make a new quiz but then select the questions from my category list where the category shared will appear.

I am out the time to create new quiz, but no reimporting questions is involved.

Also makes for nice proofreading cause if either course finds an error in my answers, I edit the questions (from either course) and then regrade and still get corrections.

I am a one man operation - so not sure if sharing extends to other teachers that would be located on the same server.

I do know that currently I have had a course with nearly 12000 questions and other courses with 1200-3000 and never experienced any problems.

not sure if this helps but it might be a way to survive till new improvements are done.

Louis
In reply to Louis Fleming

Ang: Re: Ang: Re: Ang: Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Morten Brydensholt -

Louis

Thanks for sharing thoughts and kind advices.

We do share questions among each other using the method of publishing.
Or rather we did share questions among each other with this feature. Questions made public (and 'borrowed' this way) were not editable and files were not readable for students in the destination courses (because students were not enrolled in the source course). Also this method gave problems with hidden questions in empty categories. Imagine you have quizzes with borrowed questions and then someone imports a quiz from this course to another course. Then this course gets filled with all regular questions and all borrowed questions (which you cannot edit).

Today I'm not sure if you can take ownership of imported questions through the publish method because I dare not take the risk of using this method anymore (in 1.8.3). And I'm also not sure if the importing of quizzes also imports borrowed questions.

So the safe way seems to be exporting questions to the desktop and zipping and downloading files to the desktop. Then import questions, upload and unzip files and relink questions.
I know I can make life a little easier by putting files in the file system of the front page which all student have access to, but I don't want non-admin Moodle teachers to put them there in the first place.

I guess things are a lot easier when operating one-man smile

Thanks again

Morten

In reply to Anthony Borrow

Re: Ang: Re: Importing one quiz imports all questions

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Anthony,

> How else could you ensure that a quiz with random questions in it will work.

Personally I never ever use random questions in a quiz. Anyway, the import process could be made to check whether the imported quizzes do or don't use random questions and, if they don't, then only import those questions which are actually used in them. That would make sense.

I'm afraid not many Moodle users use the import from course facility anyway, or am I wrong?

Joseph

In reply to Joseph Rézeau

Ang: Re: Ang: Re: Importing one quiz imports all questions

by Morten Brydensholt -

Joseph,

>I'm afraid not many Moodle users use the import from course facility anyway, or am I wrong?

Speaking for myself; I administer several Moodle sites for institutions and business as well. The feature of reusing and copying of material is the most wanted thing.

And I never use random questions neither.

Morten

In reply to Morten Brydensholt

Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Jamie Pratt -
In Moodle 1.9 you will be able to share questions at the Course Category (remember Course Categorys can be nested) and System level which would be one solution to sharing questions across courses.
In reply to Jamie Pratt

Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Yes, Jamie. But it's a pity that no provision has been yet made for sharing questions between all the courses taught by one same teacher. There is a "teacher" hierarchy level missing in Moodle, which means that, as I teach a number of similar courses on my university Moodle platform, I cannot easily "share" resources betwen my own courses.
Joseph
In reply to Joseph Rézeau

Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Jamie Pratt -
You could do something like this.

In Moodle 1.9 we have separate permissions for questions you created and questions that others created. So you could give teachers use/view/edit mine permissions in any context (probably a context above course level). This would allow teachers to save their questions in the System / a Course Cat context but not be able use others' questions.
In reply to Jamie Pratt

Re: Ang: Re: Ang: Re: Importing one quiz imports all questions

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Thanks Jamie, I'll give it a try and report here,
Joseph