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

Create a "top" category in question bank

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Restore a backup from older versions

      1. Log in to a Moodle as admin and restorea course from the file backup-moodle2-course-4-c102-20180116-1830-nu.mbz
      2. Confirm that you see the following warnings in the middle of restore process 
        • The questions category "Default for Miscellaneous", originally at system/course category context in backup file, will be created at course context by restore
        • The questions category "Cat A", originally at system/course category context in backup file, will be created at course context by restore
        • The questions category "Cat B", originally at system/course category context in backup file, will be created at course context by restore
      3. Confirm that the restore process completes without any error
      4. Visit the course you just restored and go to the question bank
      5. Confirm that you see the following categories in the question bank and the numbers in front of each category are the same:
        • Question categories for 'Course: xyz'
          • Cat 1 (2)
          • Cat 2 (2)
          • Cat 3 (3)
          • Cat A (2)
          • Cat B (2)
          • Default for C102 (0)
          • Default for Miscellaneouse (0)
        • Question categories for 'Category: Miscellaneous'
          • Default for Miscellaneous (0)
        • Questions categories for 'System'
          • Cat I (2)
          • Cat II (2)
          • Default for System (0)
      6. Go to the course main page and click on the single quiz activity the course has
      7. Confirm that the quiz has 10 questions, 4 of which are random questions from the following categories:
        Cat 2, Cat 3, Cat B, Cat II

      Random question from Top category

      1. Edit quiz questions and remove all non-random questions from the quiz
      2. Add a random question to the quiz and set the category of the random question (i.e. the category that the random question is going to be picked from) to the "Top" category of the course.
      3. Confirm that a new question titled "Random (Any category in this course)" is added to the quiz

      Export

      1. Go to the "Question bank > Export" in the course
      2. Choose the 'Moodle XML format'
      3. Confirm that the "export category" drop-sown menu contains all 'Top' categories
      4. Select the course context's 'Top' category and export questions to file
      5. Open the exported file and confirm it contains all questions that are inside any sub-categories of the exported 'Top' category

      Other things to check

      1. Go to the question bank and confirm that you cannot edit or delete any of the 'Top' categories
      2. Edit the quiz's questions and try to add a true/false question to the quiz
      3. Confirm that the category drop-down menu that is displayed on the 'add question' form does not contain ant 'Top' category

      Backup/Restore from same version

      1. Create a backup of the course
      2. Restore the backup into a new course
      3. Confirm that the new course has the same question categories and questions as the original course
      Show
      Restore a backup from older versions Log in to a Moodle as admin and restorea course from the file  backup-moodle2-course-4-c102-20180116-1830-nu.mbz Confirm that you see the following warnings in the middle of restore process  The questions category "Default for Miscellaneous", originally at system/course category context in backup file, will be created at course context by restore The questions category "Cat A", originally at system/course category context in backup file, will be created at course context by restore The questions category "Cat B", originally at system/course category context in backup file, will be created at course context by restore Confirm that the restore process completes without any error Visit the course you just restored and go to the question bank Confirm that you see the following categories in the question bank and the numbers in front of each category are the same: Question categories for 'Course: xyz' Cat 1 (2) Cat 2 (2) Cat 3 (3) Cat A (2) Cat B (2) Default for C102 (0) Default for Miscellaneouse (0) Question categories for 'Category: Miscellaneous' Default for Miscellaneous (0) Questions categories for 'System' Cat I (2) Cat II (2) Default for System (0) Go to the course main page and click on the single quiz activity the course has Confirm that the quiz has 10 questions, 4 of which are random questions from the following categories: Cat 2, Cat 3, Cat B, Cat II Random question from Top category Edit quiz questions and remove all non-random questions from the quiz Add a random question to the quiz and set the category of the random question (i.e. the category that the random question is going to be picked from) to the "Top" category of the course. Confirm that a new question titled "Random (Any category in this course)" is added to the quiz Export Go to the "Question bank > Export" in the course Choose the 'Moodle XML format' Confirm that the "export category" drop-sown menu contains all 'Top' categories Select the course context's 'Top' category and export questions to file Open the exported file and confirm it contains all questions that are inside any sub-categories of the exported 'Top' category Other things to check Go to the question bank and confirm that you cannot edit or delete any of the 'Top' categories Edit the quiz's questions and try to add a true/false question to the quiz Confirm that the category drop-down menu that is displayed on the 'add question' form does not contain ant 'Top' category Backup/Restore from same version Create a backup of the course Restore the backup into a new course Confirm that the new course has the same question categories and questions as the original course
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-61132-master

      Description

      Currently there is a "fake" question category for each context. It does not exist in the database, but in places in the UI it is shown as a "fake" question category named top. We need to turn this into a real question category in the database, and enforce some validation rules to prevent modifying it, adding questions to it, or adding new questions categories as siblings of it. This allows us to (for example) add questions from any category in this course that have the label "midterm4" (because all categories will be a child of this top question category). We will need to modify import/restore to auto-create this top level category for backups older than $versionnumber (and enforce the other validation rules).

        Attachments

        1. Screenshot from 2018-01-13 22-58-29.png
          Screenshot from 2018-01-13 22-58-29.png
          204 kB
        2. backup-moodle2-course-4-c102-20180116-1830-nu.mbz
          9 kB
        3. Confirmed1.PNG
          Confirmed1.PNG
          63 kB
        4. Confirmed2.PNG
          Confirmed2.PNG
          53 kB
        5. Confirmed3.PNG
          Confirmed3.PNG
          80 kB
        6. Confirmed4.PNG
          Confirmed4.PNG
          52 kB
        7. Confirmed5.PNG
          Confirmed5.PNG
          31 kB
        8. Confirmed6_Export1.PNG
          Confirmed6_Export1.PNG
          32 kB
        9. Confirmed7_Export.PNG
          Confirmed7_Export.PNG
          141 kB
        10. Confirmed8_Other things to check.PNG
          Confirmed8_Other things to check.PNG
          31 kB
        11. Confirmed9_Backup Restore.PNG
          Confirmed9_Backup Restore.PNG
          18 kB
        12. Confirmed9_Backup Restore2.PNG
          Confirmed9_Backup Restore2.PNG
          51 kB

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  17/May/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 2 weeks Original Estimate - 2 weeks
                  2w
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 weeks, 3 hours
                  2w 3h