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

Debug warning when restoring an activity when multiple question_categories are at the same context level

    XMLWordPrintable

Details

    • MOODLE_31_STABLE
    • MOODLE_30_STABLE, MOODLE_31_STABLE
    • MDL-55565-master
    • Hide
      1. Make sure developer mode is on (DEBUG).
      2. Create a new course under the miscellaneous course category
      3. From within the question bank in the course, create 2 new question categories at the course-category level. (Course admin > Question bank > Categories)
        • Select new category
        • make sure the parent is 'Top' under the 'Miscellaneous' course category.
      4. you should now see three question categories in the section, 'Question categories for category: Miscellaneous':
        • Default for miscellaneous
        • First question category you created
        • Second question category you created
      5. create a single question under any one of the course-category level question categories
      6. create a quiz, making sure to use that question you just created
      7. Now, backup the course (you can use 'Jump to final step')
      8. Restore the course into a new course, under the miscellaneous course category using all the default settings.
      9. Confirm that you don't see any warnings.
      Show
      Make sure developer mode is on (DEBUG). Create a new course under the miscellaneous course category From within the question bank in the course, create 2 new question categories at the course-category level. (Course admin > Question bank > Categories) Select new category make sure the parent is 'Top' under the 'Miscellaneous' course category. you should now see three question categories in the section, 'Question categories for category: Miscellaneous': Default for miscellaneous First question category you created Second question category you created create a single question under any one of the course-category level question categories create a quiz, making sure to use that question you just created Now, backup the course (you can use 'Jump to final step') Restore the course into a new course, under the miscellaneous course category using all the default settings. Confirm that you don't see any warnings.
    • 3.2 Sprint 4

    Description

      A minor bug resulting in debug output to the page, when in developer mode.

      To replicate it:

      1. Make sure developer mode is on (DEBUG).
      2. Create a new course under the miscellaneous course category
      3. From within the question bank in the course, create 2 new question categories at the course-category level. (Course admin > Question bank > Categories)
        • Select new category
        • make sure the parent is 'Top' under the 'Miscellaneous' course category.
      4. you should now see three question categories in the section, 'Question categories for category: Miscellaneous':
        • Default for miscellaneous
        • First question category you created
        • Second question category you created
      5. create a single question under any one of the course-category level question categories
      6. create a quiz, making sure to use that question you just created
      7. Now, backup the course (you can use 'Jump to final step')
      8. Restore the course into a new course, under the miscellaneous course category using all the default settings.
      9. You will see something like this:

        Did you remember to make the first column something unique in your call to get_records? Duplicate value '3' found in column 'contextid'.
        line 784 of /lib/dml/pgsql_native_moodle_database.php: call to debugging()
        line 803 of /backup/util/dbops/restore_dbops.class.php: call to pgsql_native_moodle_database->get_records_sql()
        line 602 of /backup/util/dbops/restore_dbops.class.php: call to restore_dbops::restore_find_best_target_context()
        line 519 of /backup/util/dbops/restore_dbops.class.php: call to restore_dbops::prechek_precheck_qbanks_by_level()
        line 178 of /backup/util/helper/restore_prechecks_helper.class.php: call to restore_dbops::precheck_categories_and_questions()
        line 378 of /backup/controller/restore_controller.class.php: call to restore_prechecks_helper::execute_prechecks()
        line 990 of /backup/util/ui/restore_ui_stage.class.php: call to restore_controller->execute_precheck()
        line 372 of /backup/util/ui/restore_ui.class.php: call to restore_ui_stage_process->process()
        line 99 of /backup/restore.php: call to restore_ui->requires_substage()
        

      The warning is generated by a call to get_records_sql in restore_find_best_target_context(), which doesn't ask for a unique column correctly.

      Attachments

        Issue Links

          Activity

            People

              jaked Jake Dallimore
              jaked Jake Dallimore
              Adrian Greeve Adrian Greeve
              Dan Poltawski Dan Poltawski
              Andrew Lyons Andrew Lyons
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Safat Shahin, Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                12/Sep/16