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

Add a section to the edit questions mform to allow managing the course context question tags

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Set up

      1. Log in as admin
      2. Create 2 courses, c1 and c2
      3. Enrol a user, t1, as a teacher in both courses
      4. Enrol a user, t2, as a teacher only in c1
      5. Navigate to c1 and go to the question bank
        • view course > edit cog > more… > question bank
      6. Click the categories tab
      7. Add a new question category (Test category) as a top level category in the “Category Miscellaneous” context
      8. Create the Question sharer role and assign it to t1 and t2 in the system context
        • Note: When defining the permissions for the Question sharer role set the moodle/question:tagall permission to "Allow"

      Course question

      1. Log in as t1
      2. Navigate to c1 and view the question bank
      3. Create a new question (q1) in the “Default for c1” category (doesn’t matter what the question type is)
      4. CONFIRM that you see a single “Tags” section
      5. Add a course tag “c1 tag”
      6. Save changes
      7. Edit q1
      8. CONFIRM the “c1 tag” exists
      9. Log in as t2
      10. Navigate to c1 and view the question bank
      11. Edit q1
      12. CONFIRM the “c1 tag” exists

      Activity question

      1. Log in as t1
      2. Navigate to c1
      3. Create and view a quiz activity (quiz 1)
      4. View the question bank from the quiz activity
        • edit cog > question bank
      5. Set “Select a category” to “quiz 1”
      6. Create a new question
      7. CONFIRM in the create form that you see a “Tags” section
      8. CONFIRM that you can add a tag

      Course category question

      1. Log in as t1
      2. Navigate to c1 and view the question bank
      3. Set “Select a category” to the “Test category” in the Miscellaneous course category
      4. Create a new question (cat q1)
      5. CONFIRM that you see a section to add course tags (something like “Course: Course 1 tags”)
      6. CONFIRM that you see a section to add category level tags (should be called “Tags”)
      7. Add a course level tag, “c1 tag”
      8. Add a course category level tag, “misc cat tag”
      9. Save changes
      10. Edit cat q1
      11. CONFIRM that the tags you added still exist
      12. Log in as t1
      13. Navigate to c1 and view the question bank
      14. Edit cat q1
      15. CONFIRM that you see the tags added by t1

      Course category shared question

      1. Log in as t1
      2. Navigate to c2 and view the question bank
      3. Set “Select a category” to the “Test category” in the Miscellaneous course category
      4. Edit cat q1
      5. CONFIRM that you see a section for course tags. This time it’s the tags for c2 so it should be empty. You should not see the tag “c1 tag” which was added in c1.
      6. CONFIRM that you see a section for the course category tags (called "Tags"). These tags should be shared by all courses in that category so you should see the tag “misc cat tag” added in c1.
      7. Add a course level tag, “c2 tag”
      8. Save changes
      9. Navigate to c1 and view the question bank
      10. View the “Test category” questions
      11. Edit cat q1
      12. CONFIRM that you see both the course level and course category level tags
      13. CONFIRM that you do not see “c2 tag” in the course tags. You should see the “c1 tag”.

      Move question up a context

      1. Log in as t1
      2. Navigate to c1 and view the question bank
      3. Click on the “Questions” tab
      4. Set “Select a category” to the “Test category”
      5. Click the checkbox next to cat q1
      6. In the “With selected” section set to select box to “Default for system” and then click “Move to”
      7. The page should have reloaded and you should now be viewing the “Default for System” questions
      8. Edit cat q1
      9. CONFIRM that you see a section for the c1 tags and that the existing tag, “c1 tag”, is still there
      10. CONFIRM that you see a section called “Tags” and that the tag “misc cat tag” is listed
      11. Add a new tag, “sys tag”, to the "Tags" section
      12. Save changes
      13. Navigate to c2 and view the question bank
      14. Set “Select a category” to the “Default for System”
      15. Edit cat q1
      16. CONFIRM that you see the course tags for c2 not c1 (should see “c2 tag”)
      17. CONFIRM that you see the "Tags", “misc cat tag” and “sys tag”
      18. Save changes or cancel

      Move question category down a context into course

      1. Continuing from above
      2. Click on the “Questions” tab
      3. Set “Select a category” to the “Default for System”
      4. Click the checkbox next to cat q1
      5. In the “With selected” section set to select box to “Default for c2” and then click “Move to”
      6. The page should have reloaded and you should now be viewing the “Default for c2” questions
      7. Edit cat q1
      8. CONFIRM that you do not see a section for course tags
      9. CONFIRM that you see the c2 tags (“c2 tag”) and the previous system / course category tags (“misc cat tag” and “sys tag”) in the "Tags" section
      10. Cancel changes
      11. Click the checkbox next to cat q1
      12. In the “With selected” section set to select box to “Test category” and then click “Move to”
      13. Edit cat q1
      14. CONFIRM that you see a section for course c2 tags and that the tag list is empty
      15. CONFIRM that you see a section for "Tags" and that it contains all of the tags that were previously in the "Tags" section a few steps ago (“c2 tag”, “misc cat tag”, and “sys tag”).
      16. Delete “c2 tag” and “sys tag” from the "Tags"
      17. Add “c2 tag” to the course tags
      18. Save changes
      19. Navigate to c1 and view the question bank
      20. Click on the “Questions” tab
      21. Set “Select a category” to the “Test category”
      22. Edit cat q1
      23. CONFIRM that you see a section for the c1 tags and it is empty (the old tag instance was deleted when the question category got moved into the c2 course context)
      24. CONFIRM that you see the "Tags" section, it should be “misc cat tag”
      25. Add a tag to the course tags, “c1 tag”
      26. Save changes

      Move question from category into activity context

      1. Navigate to course c1
      2. View quiz 1
      3. Open the question bank
      4. Create a question (q2) in the “Default for Miscellaneous” category
        • Add a tag “q2tag” in the “Tags” section
        • Add a tag “q2c1tag” in the “Course: c1 tags” section
      5. Click the checkbox next to q2
      6. In the “With selected:” section change the select box to “Default for quiz 1” and click the “Move to >>” button
      7. Make sure the “Select a category” select box is set to “Default for quiz 1”
      8. Edit q2
      9. CONFIRM that there is a single “Tags” section and it contains both tags “q2tag” and “q2c1tag”

      The testing below is blocked by MDL-61556 and MDL-61557

      Move question category up a context

      1. Log in as t1
      2. Navigate to c1 and view the question bank
      3. Click on the “Categories” tab
      4. Click on the down arrow next to “Test category” to “Share in context for System”
      5. CONFIRM that the “Test category” moves into the “Question categories for ‘System’”
      6. Click the “Questions” tab
      7. Set “Select a category” to the “Test category”
      8. Edit cat q1
      9. CONFIRM that you see a section for the c1 tags and that the existing tag, “c1 tag”, is still there
      10. CONFIRM that you see a section for “Tags” and it has the “misc cat tag” in it
      11. Add a new tag called “sys tag” to the “Tag” section
      12. Save changes
      13. Navigate to c2 and view the question bank
      14. Set “Select a category” to the “Test category”
      15. Edit cat q1
      16. CONFIRM that you see the course tags for c2 not c1
      17. CONFIRM that you see the “Tags”, “misc cat tag” and “sys tag”
      18. Save changes or cancel

      Move question category down a context into course

      1. Continuing from above
      2. Click the “Categories” tab
      3. Click the up arrow next to “Test category” to move it all the way into the question categories for c2
      4. Click the “Questions” tab
      5. Set “Select a category” to the “Test category”
      6. Edit cat q1
      7. CONFIRM that you do not see a section for course tags
      8. CONFIRM that you see the c2 tags (“c2 tag”) and the previous system / course category tags (“misc cat tag” and “sys tag”) in the “Tags” section
      9. Cancel changes
      10. Click the “Categories” tab
      11. Click the down arrow to move the “Test category” back into the “Question categories for ‘Category: Miscellaneous’” section (assuming your course category is called “Miscellaneous”).
      12. Click the “Questions” tab
      13. Set “Select a category” to the “Test category”
      14. Edit cat q1
      15. CONFIRM that you see a section for course c2 tags and that the tag list is empty
      16. CONFIRM that you see another section for the “Tags” and that it contains all of the tags that were previously in the “Tags” section a few steps ago (“c2 tag”, “misc cat tag”, and “sys tag”).
      17. Delete “c2 tag” and “sys tag” from the “Tags”
      18. Add “c2 tag” to the course tags
      19. Save changes
      20. Navigate to c1 and view the question bank
      21. Click on the “Questions” tab
      22. Set “Select a category” to the “Test category”
      23. Edit cat q1
      24. CONFIRM that you see a section for the course c1 tags and it is empty (the old tag instance was deleted when the question category got moved into the c2 course context)
      25. CONFIRM that you see the “Tag” section, it should have “misc cat tag” in it
      26. Add a tag to the course tags, “c1 tag”
      27. Save changes

      Move question category from course into activity

      1. Continuing from above
      2. Navigate to course c1
      3. View the quiz activity (quiz 1)
      4. View the question bank from the quiz activity
        • edit cog > question bank
      5. Click the “Categories” tab
      6. Click the up arrow next to “Test category” to move it up from “Question categories for ‘Course: c1’” into “Question categories for ‘Quiz: quiz 1’”
      7. Click the “Questions” tab
      8. Set “Select a category” to the “Test category”
      9. Edit cat q1
      10. CONFIRM that you do not see a section for course tags
      11. CONFIRM that you see the c1 tags (“c1 tag”) and the previous system / course category tags (“misc cat tag” and “sys tag”) in the “Tags” section
      Show
      Set up Log in as admin Create 2 courses, c1 and c2 Enrol a user, t1, as a teacher in both courses Enrol a user, t2, as a teacher only in c1 Navigate to c1 and go to the question bank view course > edit cog > more… > question bank Click the categories tab Add a new question category (Test category) as a top level category in the “Category Miscellaneous” context Create the Question sharer role and assign it to t1 and t2 in the system context Note: When defining the permissions for the Question sharer role set the moodle/question:tagall permission to "Allow" Course question Log in as t1 Navigate to c1 and view the question bank Create a new question (q1) in the “Default for c1” category (doesn’t matter what the question type is) CONFIRM that you see a single “Tags” section Add a course tag “c1 tag” Save changes Edit q1 CONFIRM the “c1 tag” exists Log in as t2 Navigate to c1 and view the question bank Edit q1 CONFIRM the “c1 tag” exists Activity question Log in as t1 Navigate to c1 Create and view a quiz activity (quiz 1) View the question bank from the quiz activity edit cog > question bank Set “Select a category” to “quiz 1” Create a new question CONFIRM in the create form that you see a “Tags” section CONFIRM that you can add a tag Course category question Log in as t1 Navigate to c1 and view the question bank Set “Select a category” to the “Test category” in the Miscellaneous course category Create a new question (cat q1) CONFIRM that you see a section to add course tags (something like “Course: Course 1 tags”) CONFIRM that you see a section to add category level tags (should be called “Tags”) Add a course level tag, “c1 tag” Add a course category level tag, “misc cat tag” Save changes Edit cat q1 CONFIRM that the tags you added still exist Log in as t1 Navigate to c1 and view the question bank Edit cat q1 CONFIRM that you see the tags added by t1 Course category shared question Log in as t1 Navigate to c2 and view the question bank Set “Select a category” to the “Test category” in the Miscellaneous course category Edit cat q1 CONFIRM that you see a section for course tags. This time it’s the tags for c2 so it should be empty. You should not see the tag “c1 tag” which was added in c1. CONFIRM that you see a section for the course category tags (called "Tags"). These tags should be shared by all courses in that category so you should see the tag “misc cat tag” added in c1. Add a course level tag, “c2 tag” Save changes Navigate to c1 and view the question bank View the “Test category” questions Edit cat q1 CONFIRM that you see both the course level and course category level tags CONFIRM that you do not see “c2 tag” in the course tags. You should see the “c1 tag”. Move question up a context Log in as t1 Navigate to c1 and view the question bank Click on the “Questions” tab Set “Select a category” to the “Test category” Click the checkbox next to cat q1 In the “With selected” section set to select box to “Default for system” and then click “Move to” The page should have reloaded and you should now be viewing the “Default for System” questions Edit cat q1 CONFIRM that you see a section for the c1 tags and that the existing tag, “c1 tag”, is still there CONFIRM that you see a section called “Tags” and that the tag “misc cat tag” is listed Add a new tag, “sys tag”, to the "Tags" section Save changes Navigate to c2 and view the question bank Set “Select a category” to the “Default for System” Edit cat q1 CONFIRM that you see the course tags for c2 not c1 (should see “c2 tag”) CONFIRM that you see the "Tags", “misc cat tag” and “sys tag” Save changes or cancel Move question category down a context into course Continuing from above Click on the “Questions” tab Set “Select a category” to the “Default for System” Click the checkbox next to cat q1 In the “With selected” section set to select box to “Default for c2” and then click “Move to” The page should have reloaded and you should now be viewing the “Default for c2” questions Edit cat q1 CONFIRM that you do not see a section for course tags CONFIRM that you see the c2 tags (“c2 tag”) and the previous system / course category tags (“misc cat tag” and “sys tag”) in the "Tags" section Cancel changes Click the checkbox next to cat q1 In the “With selected” section set to select box to “Test category” and then click “Move to” Edit cat q1 CONFIRM that you see a section for course c2 tags and that the tag list is empty CONFIRM that you see a section for "Tags" and that it contains all of the tags that were previously in the "Tags" section a few steps ago (“c2 tag”, “misc cat tag”, and “sys tag”). Delete “c2 tag” and “sys tag” from the "Tags" Add “c2 tag” to the course tags Save changes Navigate to c1 and view the question bank Click on the “Questions” tab Set “Select a category” to the “Test category” Edit cat q1 CONFIRM that you see a section for the c1 tags and it is empty (the old tag instance was deleted when the question category got moved into the c2 course context) CONFIRM that you see the "Tags" section, it should be “misc cat tag” Add a tag to the course tags, “c1 tag” Save changes Move question from category into activity context Navigate to course c1 View quiz 1 Open the question bank Create a question (q2) in the “Default for Miscellaneous” category Add a tag “q2tag” in the “Tags” section Add a tag “q2c1tag” in the “Course: c1 tags” section Click the checkbox next to q2 In the “With selected:” section change the select box to “Default for quiz 1” and click the “Move to >>” button Make sure the “Select a category” select box is set to “Default for quiz 1” Edit q2 CONFIRM that there is a single “Tags” section and it contains both tags “q2tag” and “q2c1tag” The testing below is blocked by MDL-61556 and MDL-61557 Move question category up a context Log in as t1 Navigate to c1 and view the question bank Click on the “Categories” tab Click on the down arrow next to “Test category” to “Share in context for System” CONFIRM that the “Test category” moves into the “Question categories for ‘System’” Click the “Questions” tab Set “Select a category” to the “Test category” Edit cat q1 CONFIRM that you see a section for the c1 tags and that the existing tag, “c1 tag”, is still there CONFIRM that you see a section for “Tags” and it has the “misc cat tag” in it Add a new tag called “sys tag” to the “Tag” section Save changes Navigate to c2 and view the question bank Set “Select a category” to the “Test category” Edit cat q1 CONFIRM that you see the course tags for c2 not c1 CONFIRM that you see the “Tags”, “misc cat tag” and “sys tag” Save changes or cancel Move question category down a context into course Continuing from above Click the “Categories” tab Click the up arrow next to “Test category” to move it all the way into the question categories for c2 Click the “Questions” tab Set “Select a category” to the “Test category” Edit cat q1 CONFIRM that you do not see a section for course tags CONFIRM that you see the c2 tags (“c2 tag”) and the previous system / course category tags (“misc cat tag” and “sys tag”) in the “Tags” section Cancel changes Click the “Categories” tab Click the down arrow to move the “Test category” back into the “Question categories for ‘Category: Miscellaneous’” section (assuming your course category is called “Miscellaneous”). Click the “Questions” tab Set “Select a category” to the “Test category” Edit cat q1 CONFIRM that you see a section for course c2 tags and that the tag list is empty CONFIRM that you see another section for the “Tags” and that it contains all of the tags that were previously in the “Tags” section a few steps ago (“c2 tag”, “misc cat tag”, and “sys tag”). Delete “c2 tag” and “sys tag” from the “Tags” Add “c2 tag” to the course tags Save changes Navigate to c1 and view the question bank Click on the “Questions” tab Set “Select a category” to the “Test category” Edit cat q1 CONFIRM that you see a section for the course c1 tags and it is empty (the old tag instance was deleted when the question category got moved into the c2 course context) CONFIRM that you see the “Tag” section, it should have “misc cat tag” in it Add a tag to the course tags, “c1 tag” Save changes Move question category from course into activity Continuing from above Navigate to course c1 View the quiz activity (quiz 1) View the question bank from the quiz activity edit cog > question bank Click the “Categories” tab Click the up arrow next to “Test category” to move it up from “Question categories for ‘Course: c1’” into “Question categories for ‘Quiz: quiz 1’” Click the “Questions” tab Set “Select a category” to the “Test category” Edit cat q1 CONFIRM that you do not see a section for course tags CONFIRM that you see the c1 tags (“c1 tag”) and the previous system / course category tags (“misc cat tag” and “sys tag”) in the “Tags” section
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull Master Branch:
      MDL-61363-int-master

      Description

      Currently the "tags" section of the edit question form will only add tags to the context that question exists in. E.g. If the question is a course category level question the tag instances will be added to the course category context. If it's a course level question then the tag instances will be added to the course context.

      We need the ability to add both course context tag instances and course category context tag instances when editing a course category level question in the course context. Phew, that is confusing.

      What does this mean in practice?
      Background

      • We have 2 teachers, t1 and t2
      • We have a course (c1) that exists in a course category (cat1).
      • We have a course (c2) that exists in cat1
      • t1 and t2 are teachers in exactly 1 course each, c1 and c2 respectively.
      • There is a question bank question (q1) that exists at the course category (cat1) level.
      • The question q1 can be used by any course within cat1's context (both c1 and c2)

      Use case
      t1 logs in and views the question bank in c1. They change the category filter to see questions from cat1 which shows q1. They decide to edit q1.

      Currently, without any changes, t1 will see a single "tags" section in the edit form. Changes here will only add tag instances to the cat1 context which make them available to all courses in belonging to cat1, i.e. c1 and c2.

      However, t1 may want to add a tag instance that is specific to their course, c1, which shouldn't be visible to c2 or any other course.

      In order to solve that we can add a second "tags" section to the edit form which allows for managing tag instances at the c1 context level. Both tag sections will need to be named appropriately to reflect what context they are being applied to.

      Confirmations from MDL-61084

      • As a teacher in a course who can edit a question from the course, I can add/modify/remove tags directly on the question, in the edit question form which will apply when the question is searched for in this course
      • As a user who can edit questions outside of a course (belonging to the course category or site context), I can add/modify/remove tags directly on the question edit form, which will apply in all contexts the question can be used
      • All teachers in a course can see the full list of tags either directly attached to the question from the question bank, or only attached to the question in this course
      • Question tags are not specific to a single user (not private)
      • Course backups should contain course level question tags
      • A course restored from a backup should contain the same set of course level question tags pointing to the correct questions in all cases (same site, new site etc).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ryanwyllie Ryan Wyllie
                Reporter:
                ryanwyllie Ryan Wyllie
                Peer reviewer:
                Shamim Rezaie
                Integrator:
                Jake Dallimore
                Tester:
                Gladys Basiana
                Participants:
                Component watchers:
                Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

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

                  Time Tracking

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