What's the best way to copy 2 quizzes from one course to another?

What's the best way to copy 2 quizzes from one course to another?

Nosūtīja Melissa Benson
Atbilžu skaits: 3

Alright, so I have a teacher who has 2 quizzes that has broken links to images. For whatever reason another teacher has the same questions, with working images in another course. What is the best way for me to take those 2 quizzes and copy them into another course? It's not as simple as exporting quiz questions because they are not in their own category. I do have the sharing cart module in our Moodle site.

Vidējais novērtējums: -
Atbildot uz Melissa Benson

Re: What's the best way to copy 2 quizzes from one course to another?

Nosūtīja Tim Hunt
Core developers attēls Documentation writers attēls Particularly helpful Moodlers attēls Peer reviewers attēls Plugin developers attēls

You can't now what will fix the problem until you know what the problem really is. 'Images broken' is a symptom not a cause.

To try to get to the cause, can you show us the URL of the images, both from the course where they are working, and where they are not.

Atbildot uz Tim Hunt

Re: What's the best way to copy 2 quizzes from one course to another?

Nosūtīja Melissa Benson

So weird, I used the sharing cart and it brought over some images and then some images are still broken..weird.


I used the sharing cart..working in 1 course and not the other.


working: https://........./pluginfile.php/104926/question/questiontext/762512/2/292117/ppg__examview__math_6_final__mc032-1.jpg

not working: https://....../pluginfile.php/103361/question/questiontext/762513/2/273221/ppg__examview__math_6_final__mc032-1.jpg

Pielikums Screen Shot 2015-05-22 at 9.57.17 AM.png
Atbildot uz Melissa Benson

Re: What's the best way to copy 2 quizzes from one course to another?

Nosūtīja Tim Hunt
Core developers attēls Documentation writers attēls Particularly helpful Moodlers attēls Peer reviewers attēls Plugin developers attēls

The issue will be to do with the weird numbers in those URLs. There are 4, and taking them in order:

  1. The first number (on its own) is the context id that the question belongs to. You can find the contextid for the course by going to Course administration -> Users -> Permissions and looking at the URL. For the quiz go to Quiz administration -> Permissions. If the number does not match either of those, something is weird.
  2. The second number is the 'question usage id'. Not easy to check, but also there is probably no issue with this. If you really want to check, not the URL .../mod/quiz/attempt.php?id=123, look that up in the quiz table, and find the uniqueid for that row. That is the question usage id.
  3. The third number is the 'slot' number, so the first question (or description) in the quiz is 1, then 2, etc. Also unlikely to be wrong.
  4. The last number should be the question id, which you can see somewhere in the URL when you edit or preview the question in the question bank. If that does not match, that is why backup and restore cannot find the image to copy.

Once you have found in more detail what is wrong, then the question becomes how did it get like that? (Since this situation should never happen.) Failing to copy images with the wrong id is not really a bug. The wrong ids getting created is the bug. Unfortunately, when the time comes to copy the quiz, it is probably long after the details of how the question was created have been forgotten, so it is hard to diagnose.