Moodle
  1. Moodle
  2. MDL-5601

cloze question restore error problem

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.6.3, 1.7
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      All
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_16_STABLE, MOODLE_17_STABLE
    • Rank:
      28167

      Description

      I am currently testing backup/restore of my courses from Moodle 1.5 (on a distant site) to Moodle 1.6 (on my local install). In my 1.5 courses I have a number of questions of the Cloze type. Because the handling of quizzes and questions has beeen changed in 1.6, and because the Cloze-type questions are special, there is a special test in \question\type\multianswer\questiontype.php which yields error messages. Unfortunately, when these error messages are generated during the restoration of a course, the restoration STOPS! This is a serious problem, and I suggest replacing the error report with a notify report, which will still display the error messages but will allow the restore process to continue. I prefer this, because, once the restore process is over, I can alway edit the multianswer questions one by one and make them work.

      \question\type\multianswer\questiontype.php

      around line 535

      replace

      error(The cloze question $state->question is missing its options);

      and

      error(Can't find the subquestion $wrappedquestionid that is used as part $seqnum in cloze question $state->question);

      with

      notify(The cloze question $state->question is missing its options);

      and

      notify(Can't find the subquestion $wrappedquestionid that is used as part $seqnum in cloze question $state->question);

      Thanks!

      Joseph

        Activity

        Hide
        Martin Dougiamas added a comment -

        From Petr Skoda (skodak at centrum.cz) Friday, 26 May 2006, 12:05 AM:

        hi joseph,

        could you send me by email some sample backup for testing?

        From Joseph R?zeau (joseph.rezeau at uhb.fr) Friday, 26 May 2006, 09:30 PM:

        Hi Petr,

        I have fine-tuned analysis of reported bug. It happens only when these conditions are met:

        • restoring a course from 1.5 to 1.6 beta 5
        • course contains at least quiz containing at least one question of the Cloze question type
        • backup includes a quiz (with at least one Cloze question) AND a list of users (who may have taken this quiz or not, could not verify)

        I am attaching back-up file backup-am1se-20060526-1410.zip which includes the following:

        Sauvegarde du cours: Anglais pour Master 1 TEF Sciences de l’Éducation (AM1SE)

        Name:

        Backup Details:

        Include Quizzes with user data

        Quizzes 2

        Categories 2

        Questions 24

        Grades 50

        Include Course Users

        Users 47

        --------------------------

        and causes a restore error on 1.6 beta 5

        Quiz Freedman Oral Comprehension audio

        The cloze question xx is missing its options

        --------------------------------------------

        My diagnostic is that this sort of backup will restore OK even when it includes a quiz with a Cloze type question, but will cause a restore ERROR if it also includes a list of Course users.

        Joseph

        From Joseph R?zeau (joseph.rezeau at uhb.fr) Saturday, 29 July 2006, 05:56 AM:

        Now using version 1.6 I am still having a problem with restoration of courses with a quiz including Cloze questions AND students' results.

        SCENARIO:

        On distant Moodle site (university): quiz contains cloze questions including MCQ and short answer, authored with Moodle 1.5 during the academic year. Distant site upgraded (smoothly) to 1.6 at the end of June.

        Today (July 28th) I did a backup of one whole course on distant site. Downloaded the backup file to my local computer

        On local Moodle site (Moodle 1.6.1): If I do a restore of the whole course, I get the following error messages when Moodle is trying to restore my Quiz.

        a) lots of notify messages Could not recode multichoice answer id for state

        b) one fatal error message Can't find the subquestion that is used as part in cloze question 62 which stops the restore process altogether... GRRRR...

        SOLUTION is the same as in my previous post dated 25-May-2006: I simply comment out the error message - or I replace error() with notify() - in questiontypemultianswerquestiontype.php, at line 556:

        error(Can't find the subquestion $wrappedquestionid that is used as part $seqnum in cloze question $state->question);

        When I do this, in spite of the notify messages, the restore process can proceed to its end, and ... the quiz with its cloze questions is perfectly restored, as well as the student's attempts.

        My question: why do we still have an ERROR message in that file which blocks things for good, when a simple notify message would be enough ???

        Joseph

        From Tim Hunt (T.J.Hunt at open.ac.uk) Monday, 31 July 2006, 05:54 PM:

        I think your 'solution' is not going to work in every case. The bit that fails is when it tries to get a record from the database to change some of the ids if necessary. That's what the restore process calls recoding.

        Now, in your case, it seems that the recoding is not necessary, so everything works despite the error. But in other cases, it might not work.

        Unforunately, at the moment, I don't understand how backup and restore works very well, and I don't understand how cloze questions work very well, so put the two together, and I am really out of my depth.

        When might the recoding be necessary? What about when you try to restore the same file twice into the same installation of Moodle? Perhaps restore it in to a new course each time, and check they both work. Then delete the first restored course, and see if the second one still works.

        If we can test this enough and are confident it works, I might check-in the fix. But I really hate checking in code I don't understand.

        Show
        Martin Dougiamas added a comment - From Petr Skoda (skodak at centrum.cz) Friday, 26 May 2006, 12:05 AM: hi joseph, could you send me by email some sample backup for testing? From Joseph R?zeau (joseph.rezeau at uhb.fr) Friday, 26 May 2006, 09:30 PM: Hi Petr, I have fine-tuned analysis of reported bug. It happens only when these conditions are met: restoring a course from 1.5 to 1.6 beta 5 course contains at least quiz containing at least one question of the Cloze question type backup includes a quiz (with at least one Cloze question) AND a list of users (who may have taken this quiz or not, could not verify) I am attaching back-up file backup-am1se-20060526-1410.zip which includes the following: Sauvegarde du cours: Anglais pour Master 1 TEF Sciences de l’Éducation (AM1SE) Name: Backup Details: Include Quizzes with user data Quizzes 2 Categories 2 Questions 24 Grades 50 Include Course Users Users 47 -------------------------- and causes a restore error on 1.6 beta 5 Quiz Freedman Oral Comprehension audio The cloze question xx is missing its options -------------------------------------------- My diagnostic is that this sort of backup will restore OK even when it includes a quiz with a Cloze type question, but will cause a restore ERROR if it also includes a list of Course users. Joseph From Joseph R?zeau (joseph.rezeau at uhb.fr) Saturday, 29 July 2006, 05:56 AM: Now using version 1.6 I am still having a problem with restoration of courses with a quiz including Cloze questions AND students' results. SCENARIO: On distant Moodle site (university): quiz contains cloze questions including MCQ and short answer, authored with Moodle 1.5 during the academic year. Distant site upgraded (smoothly) to 1.6 at the end of June. Today (July 28th) I did a backup of one whole course on distant site. Downloaded the backup file to my local computer On local Moodle site (Moodle 1.6.1): If I do a restore of the whole course, I get the following error messages when Moodle is trying to restore my Quiz. a) lots of notify messages Could not recode multichoice answer id for state b) one fatal error message Can't find the subquestion that is used as part in cloze question 62 which stops the restore process altogether... GRRRR... SOLUTION is the same as in my previous post dated 25-May-2006: I simply comment out the error message - or I replace error() with notify() - in questiontypemultianswerquestiontype.php, at line 556: error(Can't find the subquestion $wrappedquestionid that is used as part $seqnum in cloze question $state->question); When I do this, in spite of the notify messages, the restore process can proceed to its end, and ... the quiz with its cloze questions is perfectly restored, as well as the student's attempts. My question: why do we still have an ERROR message in that file which blocks things for good, when a simple notify message would be enough ??? Joseph From Tim Hunt (T.J.Hunt at open.ac.uk) Monday, 31 July 2006, 05:54 PM: I think your 'solution' is not going to work in every case. The bit that fails is when it tries to get a record from the database to change some of the ids if necessary. That's what the restore process calls recoding. Now, in your case, it seems that the recoding is not necessary, so everything works despite the error. But in other cases, it might not work. Unforunately, at the moment, I don't understand how backup and restore works very well, and I don't understand how cloze questions work very well, so put the two together, and I am really out of my depth. When might the recoding be necessary? What about when you try to restore the same file twice into the same installation of Moodle? Perhaps restore it in to a new course each time, and check they both work. Then delete the first restored course, and see if the second one still works. If we can test this enough and are confident it works, I might check-in the fix. But I really hate checking in code I don't understand.
        Hide
        Tim Hunt added a comment -

        I checked in the fix (change the error to a notify) on the grounds that it might help some people, and it should not make matters worse.

        Show
        Tim Hunt added a comment - I checked in the fix (change the error to a notify) on the grounds that it might help some people, and it should not make matters worse.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: