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

Restoring a quiz using a mod_qbank question to another course creates an erroneous category

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 5.0
    • 5.0
    • Questions
    • MOODLE_500_STABLE
    • MOODLE_500_STABLE
    • MDL-84037_main
    • Hide
      1. Create 2 courses: "Course 1" and "Course 2"
      2. Go to Course 1 > Question banks and create a default question bank for the course.
      3. Create a true/false question in the question bank.
      4. Create a quiz, "Test quiz" on the course.
      5. Go to "Test quiz" > Questions, click "Add question" > "add from question bank".
      6. Switch to the course's default question bank and select the question you created.
        • Confirm that the question is shown with a "Course 1 question bank" badge.
      7. Back up the quiz.
      8. Restore the backup to "Course 2".
      9. Go to "Course 2" > "Test quiz" > "Questions"
        • Confirm that the restored quiz contains the question from the original quiz.
        • Confirm that the question is shown with a "Course 1 question bank" badge.
      10. Click on the "Course 1 question bank" badge
        • Confirm that you are now in the original "Course 1 question bank" activity on the original course
      11. Go back to the question list in the restored quiz.
      12. Click on the edit icon next to the question name
        • Confirm The edit form is shown.
      Show
      Create 2 courses: "Course 1" and "Course 2" Go to Course 1 > Question banks and create a default question bank for the course. Create a true/false question in the question bank. Create a quiz, "Test quiz" on the course. Go to "Test quiz" > Questions, click "Add question" > "add from question bank". Switch to the course's default question bank and select the question you created. Confirm that the question is shown with a "Course 1 question bank" badge. Back up the quiz. Restore the backup to "Course 2". Go to "Course 2" > "Test quiz" > "Questions" Confirm that the restored quiz contains the question from the original quiz. Confirm that the question is shown with a "Course 1 question bank" badge. Click on the "Course 1 question bank" badge Confirm that you are now in the original "Course 1 question bank" activity on the original course Go back to the question list in the restored quiz. Click on the edit icon next to the question name Confirm The edit form is shown.
    • Hide

      Code verified against automated checks.

      Checked MDL-84037 using repository: https://github.com/marxjohnson/moodle.git

      More information about this report

      Built on: Fri Dec 20 10:06:23 AM UTC 2024

      Show
      Code verified against automated checks. Checked MDL-84037 using repository: https://github.com/marxjohnson/moodle.git main (0 errors / 0 warnings) [branch: MDL-84037_main | CI Job ] More information about this report Built on: Fri Dec 20 10:06:23 AM UTC 2024
    • Show
      Launching automatic jobs for branch MDL-84037 _main https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/17774/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/60538/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/60539/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/60540/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/60541/ App tests (stable app version) Built on: Fri Dec 20 10:31:29 UTC 2024

      Steps to reproduce:

      1. Create 2 courses: "Course 1" and "Course 2"
      2. Go to Course 1 > Question banks and create a default question bank for the course.
      3. Create a true/false question in the question bank.
      4. Create a quiz, "Test quiz" on the course.
      5. Go to "Test quiz" > Questions, click "Add question" > "add from question bank".
      6. Switch to the course's default question bank and select the question you created.
        • Confirm that the question is shown in with a "Course 1 question bank" badge.
      7. Back up the quiz.
      8. Restore the backup to "Course 2".
      9. Go to "Course 2" > "Test quiz" > "Questions"
        • Confirm that the restored quiz contains the question from the original quiz.
      10. Click on the edit icon next to the question name
        • Expected: the edit form is shown
        • Actual: An exception is shown "Coding error detected, it must be fixed by a programmer: Invalid context id specified context::instance_by_id()". This is due to it trying to load the question category from a course context, which is no longer a valid context for questions.

        1. 84037 test - bank badge.png
          161 kB
          Andrew Gosali
        2. 84037 test - before backup.png
          78 kB
          Andrew Gosali
        3. 84037 test - edit button.png
          109 kB
          Andrew Gosali
        4. 84037 test - restored.png
          101 kB
          Andrew Gosali

            marxjohnson Mark Johnson
            marxjohnson Mark Johnson
            Simon Adams Simon Adams
            Tim Hunt Tim Hunt
            Andrew Gosali Andrew Gosali
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 30 minutes
                1h 30m

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