problems after deleting question

problems after deleting question

autor Terry Nolan -
Počet odpovedí: 3

Hi all,

I help support a Moodle site and my client called in a panic yesterday because he deleted a question that was part of a quiz users had already taken.

Here is the background, he had a quiz of 35 questions that was randomly choosing the questions from a question pool.  After users had already started taking the quiz, he realized one of the questions did not have the correct answer.  He was not sure what to do so he deleted that question.  Then he hit ReGrade.

Now he is wondering if the grades are accurate or if he needs to make adjustments for the question he deleted.

My questions are this:

1) why was restore not available for the question he deleted?  I see other questions greyed out with the restore icon but not for this question.

2) If a user got that question on their quiz (because he used random question, not everyone would have gotten the deleted one), what happened to their grade when he deleted the question and Regraded?

3) What does it mean on a user's quiz results when it says "This question has been deleted..." but there are no marks for that question? (not correct nor incorrect) 

We seem to have a few questions that were deleted (even though he says he only deleted one) and I have no way to tell which question it was.

Thanks for any thoughts.  Sorry for so many questions.

Terry

Priemer hodnotení : -
V odpovedi na Terry Nolan

Re: problems after deleting question

autor Tim Hunt -
Obrázok: Core developers Obrázok: Documentation writers Obrázok: Particularly helpful Moodlers Obrázok: Peer reviewers Obrázok: Plugin developers
1) If Moodle can detect that a question is in use, then when you ask to delete it, it just marks it hidden instead of really deleting it.

If a question is marked as hidden, then it can be undeleted.

Unfortunately, the way things are stored in the database, it is almost impossible to tell when a question has been used by a random question. This is MDL-5780.

2) I didn't actually know what happens in this situation. Looking at the code, it seems that it regrades any questions that still exist. Any questions that have been deleted are not regraded, so the score for them is not changed.

3) What happens here is that, on the review screen, it displays this message in place of any question that was deleted. However, the score that the student got when they attempted that question is still stored in the database.


If you want to poke around in the database, then student responses and scores are stored in the mdl_question_states table, and for random questions, the answer column starts random123-, where 123 is the id of the question that the student actually saw. That is, the 123 bit refers to the id column of the mdl_question table.

If you can work out the id of the question that was deleted, suppose it was 123, and suppose you create a new version of this question, and it gets id 234, then you could try a query like

UPDATE mdl_question_states SET answer = REPLACE(answer, 'random123-', 'random234-') WHERE answer LIKE 'random123-%';

However this kind of fiddling around in the database is very dangerous, so only do it if you understand what you are doing, have a full backup, and have practised on a test installation of Moodle first.


V odpovedi na Tim Hunt

Re: problems after deleting question

autor Terry Nolan -

Tim,

Thank you so much.  That really helps.

Ultimately what we really need to know is who got that question so then we can adjust their grade accordingly.  I don't really want to change the database.  But this is a quiz where people only get credit if they got a certain grade.  So we just need to see where that deleted question may have made a difference.  And I think looking at the mdl_question_states table will help. 

Terry

V odpovedi na Tim Hunt

Re: problems after deleting question

autor Terry Nolan -
Hi,

I was able to look in the mdl_question_states table and determine who actually got the question that was deleted. So that worked great.

My only question are these other mysterious deleted questions that don't have any marks.

This is the question we know we deleted:

This question has been deleted. Please contact your teacher
Incorrect
Marks for this submission: 0/1.

But here is another one that says it was deleted:

This question has been deleted. Please contact your teacher
 

The second one does not have any marks. So what is happening on the second deleted question that is not showing any marks.

Thanks!

Terry