Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-78902

Error when restoring quiz with random questions from Moodle 3.9 to 4.1

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-78902_403
    • Hide

      These minimal testing instructions just replecate what is in the new Unit test.

      1. Prepare Moodle 3.9 environment.
        1. In the 3.9 Moodle, create a course and a quiz activity.
        2. Go to question bank and create a question in the Quiz activity level category.
        3. Go to Edit screen, click "add", and choose "a random question".
        4. Choose the quiz activity category which is included the question which was made in the previous step.
        5. Create a backup for the activity.
      2. Prepare the latest Moodle environment.
        1. Create a course.
        2. Restore the activity from the backup which was made from the Moodle 3.9.
        3. Go to the quiz activity and go to the "Questions" tab.
        4. Click "See questions"
        5. Confirm you can see the questions

      A thorough test would create a course with a quiz, with quetsions in both teh course and quiz qutesion bank, and where the quiz contains a mixture of random, and non-random questions, from both the course and quiz question banks. But, I don't have the time to write that out in full right now.

      Show
      These minimal testing instructions just replecate what is in the new Unit test. Prepare Moodle 3.9 environment. In the 3.9 Moodle, create a course and a quiz activity. Go to question bank and create a question in the Quiz activity level category. Go to Edit screen, click "add", and choose "a random question". Choose the quiz activity category which is included the question which was made in the previous step. Create a backup for the activity. Prepare the latest Moodle environment. Create a course. Restore the activity from the backup which was made from the Moodle 3.9. Go to the quiz activity and go to the "Questions" tab. Click "See questions" Confirm you can see the questions A thorough test would create a course with a quiz, with quetsions in both teh course and quiz qutesion bank, and where the quiz contains a mixture of random, and non-random questions, from both the course and quiz question banks. But, I don't have the time to write that out in full right now.

      It appears that if a quiz from 3.9 with random questions in default quiz categories and subcategories gets restored into 4.1, an error is displayed when clicking the (see questions) link in the quiz questions page.

      Steps to replicate:

      3.9.22+ (Build: 20230721)'

      1. Create a course.
      2. Add a quiz and leave it for now.
      3. Go to the question bank
      4. Add questions under Default course category.
      5. Create a subcategory under Default course category and add questions onto it.
      6. Go back to the quiz
      7. Add a new question to the quiz (this is to populate the Default for quiz category)
      8. Go back to the question bank and under the category Default for quiz category, add a subcategory and then add questions onto it too.
      9. Go back to the quiz and then click questions.
      10. Add Random questions from the Default for quiz category
      11. Add Random questions from the subcategory under the Default for quiz category
      12. Add Random questions from the Default for quiz and its subcategories.
      13. Create a backup of that quiz and download it.

       

      Using 4.1 4.1.4+ (Build: 20230728), restore the backup quiz into a course.

      Visit the quiz and click Questions.

      Click the (see questions) for questions 6, 7, or 8. Note that the other questions are not affected.

      RESULT

      Error will be displayed.

      question/invalidcategoryMore information about this error
          Debug info:  
      Error code: invalidcategory
      $a contents: 
          
          Stack trace:  line 395 of /question/editlib.php: moodle_exception thrownline 219 of /question/editlib.php: call to question_build_edit_resources()line 30 of /question/edit.php: call to question_edit_setup() 

      Note. I have added the backup MBZ file for reference. I added screenshots for reference of the question bank format and quiz questions layout for 3.9 and the questions layout for 4.1.

       

            tomotsuyuki Tomo Tsuyuki
            jebarvia Joshua Ebarvia
            Glyn (Mathew) May Glyn (Mathew) May
            Tim Hunt Tim Hunt
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            6 Vote for this issue
            Watchers:
            33 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 4 hours, 22 minutes
                2d 4h 22m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.