Deleted a quiz, resulting in deletion of questions

Deleted a quiz, resulting in deletion of questions

de Richard Michael Coo -
Número de respuestas: 2

Hi all, I've run into a problem and I badly need help.  Thanks in advance.

 

I tried to import some questions from another quiz, so I created a quiz called "Final Exam",and using the question bank, I moved the categories of the questions to "Default for Final Exam".

However I did not get the results I want, so I deleted "Final Exam", and tried to duplicate "Midterm Exam".  This resulted in all questions being deleted.

 

I restored the questions and categories by re-inserting data from a backup, but I cannot review the attempts.

It says:  Can not find data record in database table context.

Moodle version is 2.5

Promedio de valoraciones: -
En respuesta a Richard Michael Coo

Re: Deleted a quiz, resulting in deletion of questions

de Tim Hunt -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers

Questions in the Moodle database are identified by a unique id. You can see that id in the URL when you edit or preview a question.

When you deleted the old questions, those ids were no longer used.

When you re-inserted the data from a backup, that will have created new questions with new ids.

You may be able to fix things by finding the data (in mdl_question_attempts) that points to the old question ids, and manually fix it to point to the corresponding new question ids.

However, it is not quite that easy. For example, if you are using multiple choice questions, then as well is referring to the question.id, there will also be other data (in question_attempt_step_data) which refers to other ids, like the question_answers.id, and that will have to be fixed too.

En respuesta a Tim Hunt

Re: Deleted a quiz, resulting in deletion of questions

de Richard Michael Coo -

Thanks Tim!

I modified the backup to do INSERT IGNOREs...

But I only touched question and question_categories...didn't think there are too many tables involved...

I'll just let it stay that way, the exam is already graded thankfully, and it was the only exam that got messed up.

I can't review an entire quiz, but I can review each question attempt individually as a.....uhmm....workaround ^_^