Questions being duplicated in Question Bank

Questions being duplicated in Question Bank

by Kathleen Burns -
Number of replies: 9

We are on 2.5.3 (20131111).  We store our questions in question categories at system-level, so they may be used in ALL our courses.

Last week I noticed that most of the questions (but not all) were duplicated within their categories (image attached).  I used the date stamp to determine which question was the most recently edited, and save ONLY that one.  

It appears that after nightly backups, the questions are again duplicated.  But ONLY in certain question categories.

The only thing these particular questions have in common is that they have been installed in 100% randomized quizzes.  Could that be causing the duplication?

We have hundreds of other questions at system-level that are behaving correctly.

Or might there be something misbehaving with our course backups?

Thanks very much.

Kathleen

Average of ratings: -
In reply to Kathleen Burns

Re: Questions being duplicated in Question Bank

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

This almost certainly is a bug to do with backup and restore of shared questions.

sad

Those are nasty bugs to have to fix, and there are already some open in the Moodle Tracker.

What would be helpful is precise steps to reproduce a minimal example. Something like:

  1. Create a course category.
  2. Create a test course in that category.
  3. Create one quiz in that course.
  4. Create one true/false questions here in the question bank.
  5. Add that question to the quiz like so.
  6. Backup the course.
  7. Restore it with these options.
  8. Boom! you have a duplicate question here.

There are details there that need to be made precise before we have something we can investigate.

Average of ratings: Useful (2)
In reply to Tim Hunt

Re: Questions being duplicated in Question Bank

by Kathleen Burns -

Tim:  I'm performing the test now.  Will report back again after the usual overnight course backups.  But, I was trying to figure out why our question text (not the question name, but the text) appears in ALL CAPS. (Image attached)  Does this indicate that the question is shared?  I have only noticed this behavior since our upgrade to 2.5.3 about 6 weeks ago.  [None of our question text is capitalized.]  I will report back tomorrow if questions get replicated again.  

Sorry to add fuel to the topic, but I suspect these issues are related.

Thanks very much for your guidance.  Kathleen

Attachment Ques Text Appears in ALL CAPS.png
In reply to Kathleen Burns

Re: Questions being duplicated in Question Bank

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The all caps is because that bit of the question text is bold. Where it is displayed there, there is some code the covert the HTML to plain text, which does that to bold.

In reply to Tim Hunt

Re: Questions being duplicated in Question Bank

by Kathleen Burns -

OK, Tim.  I now understand what you are saying.

I cleaned up our entire Question Bank last week.  All looked good for several days.

I restored 8 courses from backup yesterday, and now most of the questions (but not all) have been duplicated in the system-level categories.

Now I see the problem, and I will create/add to a moodle tracker issue, per your link above.  

Very much appreciate your input;  I will start creating my quizzes "from scratch" for now.  Hopefully, a good solution.

 

In reply to Kathleen Burns

Re: Questions being duplicated in Question Bank

by Cris Fuhrman -

Kathleen wrote:

The only thing these particular questions have in common is that they have been installed in 100% randomized quizzes.  Could that be causing the duplication?

From what I understood from discussions regarding another bug related to randomized questions in a quiz, those questions are "hidden" in the question bank.

Could it be that such a solution (hidden questions as an implementation to randomized questions from a category) is causing several special-case fixes (bugs) in other parts of Moodle (e.g. backup/restore in this case)? There is also https://tracker.moodle.org/browse/MDL-20154 

In reply to Kathleen Burns

Re: Questions being duplicated in Question Bank

by Kathleen Burns -

We have upgraded to Moodle 2.8  (ver Joule2 through Moodelrooms), and the question duplications/triplications have returned.  Not only are the questions appearing in the question bank multiple times, but the entire question bank categories are being duplicated and triplicated.  If we use randomly-selected questions, our students are being served the same question multiple times in a single quiz.  I'm wondering if anyone has a solution to this problem. 

We choose to keep our questions at the system level so the same questions can be used in many quizzes across our site.  If a question must be tweaked, the tweak trickles down throughout all the active quizzes.  Thanks for your ideas.  Kathleen

Attachment QuestionsDuplicating-TriplicatingInSystemLevelQuestionBank.PNG
In reply to Kathleen Burns

Re: Questions being duplicated in Question Bank

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 am not really sure what is going on here. It does not seem to correspond to any existing bug report.  https://tracker.moodle.org/issues/?jql=project%20%3D%20MDL%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20Questions%20AND%20component%20%3D%20Backup


I don' think that the use of random questions in your quiz is significant to what is causing the problems. However, once you have duplicate questions, then the random questions in the quiz may select the 'same' question more than once.

My best guess at the root cause is that it is cause by backup and restore (or something like 'duplicate activity', or rolling a course forward between semesters, that uses the backup and restore code behind the scenes). Reasons for this are the duplicates are attributed to an admin-type user, likely the person who did the roll-forwards/duplicate.

To really understand what is going on, we need to find what triggers a new duplicate to appear. (What often gets called "Steps to reproduce".) Something like 

  1. If my Moodle site is in this state.
  2. And I do this action.
  3. Then a new duplicate appears.

The work of analysing what is going wrong, to get the simplest possible steps to reproduce, should not be underestimated. But it is a vital part of the process of fixing a bug like this. Once you have a reproducible way to trigger the problem, it becomes much, much easier to fix.

In reply to Kathleen Burns

Re: Questions being duplicated in Question Bank

by Kathleen Burns -

One more piece of the puzzle to share ... hoping it sparks a bright idea.  In the image provided yesterday, I looked at the created / last saved dates for Q11 and find the following:

All three questions have exactly the same Question name.  (PIKS,.... Q11 ... date uploaded).

However, the created / last saved dates differ. (Because edits were made to a question when an error existed either in the question text or in the feedback.)

First Q11 in the list:  Created 8/1/2013 - Last saved on 11/18/2013  (Had wrong answer marked correct.)

Second Q11 in the list:  Created 8/1/2013 - Last saved 8/1/2013 (Had wrong answer marked correct.)

Third Q11 in the list:  Created 8/1/2013 - Last saved 4/1/2014   **two different Admin logins used. (Answer is finally marked correct.)

Now, when we change a question, we rename it in the Question name text box.  But we did not do that a year ago.  Could it be that the backup / restore is identifying these questions as all different, due to the created and last saved dates acting as a criterion?

Thanks for anyone's thoughts.



In reply to Kathleen Burns

Re: Questions being duplicated in Question Bank

by Bob Fix -
Hello all,


I'm wondering if there has been any further discussion on this item.  We are seeing this occuring in our Moodle Installation as well.  Similar to Kathleen's issue, the scenario that we have seen is that when a course is copied - these system level questions duplicate.  Here is some additional questions that we have seen.

First Observation:
There are scenarios in which a course is built in a staging environment and then questions are exported from staging and imported into our production environment.  My understanding (limited) of backup and restore is that on version 2.x when a course is requested, the backup process will create an XML file of all the potential questions needed for the course (among other things).  During the restore process - the restore will look for the question id and stamp.  If they match - great.  If not a question is inserted.

Could the stamp on a question be incorrect if imported from a different environment?  Or - what exactly is being compared?  As only questions that we have modified get duplicated.  In looking at the questions in the key_question table - The stamps between the edited question and duplicates are the same, but the version is different (as I would expect).  What is the question version being compared against?

Second Observation:

If we are editing a system level question while a course is being created, duplicates seem to get occur.  Not just where we were editing, but across the course.  Could the record locks be occuring during the course copy that does not allow for the query/compare to complete successfully that could cause a question to get inserted?  I wouldn't think so - but just not trying to rule anything out.

Thanks for any information you could provide.

Bob