Missing questions when importing a quiz [m3.1.1]

Missing questions when importing a quiz [m3.1.1]

by Dave Perry -
Number of replies: 3
Picture of Testers

When trying to import a quiz from one course to another, I get the following error:

Failed to find an answer matching "To measure when waxing eyebrows" in the question_answers database table. This occurred while restoring the question with id 17342 in the backup file, which has been matched to the existing question with id 37888 in the database

It takes me to this page:

http://docs.moodle.org/31/en/error/moodle/error_question_answers_missing_in_db

Now, from the error output it says it was able to do a match. So why does it not fix the database entries? That would be really helpful.

If a developer wants to look at this, I'm happy to provide an mbz backup just containing the quizzes.

This has happened every time I've tried to import a quiz from one page to another for a while now (probably since the upgrade to 3.1 - we tried upgrades to 3.3 but the version differences in PHP7, Apache 2.4 etc caused too many issues, and we've been told we're going Canvas next academic year so question whether it's worth the time building a new server).

Average of ratings: -
In reply to Dave Perry

Re: Missing questions when importing a quiz [m3.1.1]

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

You need to read the error message carefully.

It is saying that it has matched up the question being imported with one already in the database. But then, when it tried to match up the separate multiple choice choices for that question, then it could not do that.

That is indeed an error situation, and not one that can be fixed automatically.

To understand further, you need to dig into this specifics of this situation.

In reply to Tim Hunt

Re: Missing questions when importing a quiz [m3.1.1]

by Dave Perry -
Picture of Testers

OK, I ran this query:

SELECT * FROM `mdl_question_answers` WHERE question=37888;

for both question IDs the error output gave - it returns 4 possible answers each time, so far so good.

Checking the one it was looking for specifically, it is there, BUT with a whitespace at the end. According to the page referenced by the error, there was a fix put in to deal with white spaces in the answer text (when reading them via backup) - wouldn't this fix also apply to an import where no backup was specifically made (certainly by me, does the system make one behind the scenes)?
The page doesn't reference a tracker item, for me to see if this was fixed before or after our build of moodle, or to detail what the fix does/can handle.

In reply to Dave Perry

Re: Missing questions when importing a quiz [m3.1.1]

by Dave Perry -
Picture of Testers

I looked at the tracker issue for completeness, but the original quiz was created in moodle 3.1 (or 2.9, can't remember what exact date we did the upgrade last summer).