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

Questions: Add custom fields

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Integration review in progress
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0
    • Component/s: Questions
    • Affected Branches:
      MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_400_STABLE
    • Pull Master Branch:
      master_MDL-72553_qbank_quiz
    • Testing Instructions:
      Hide
      Upgrade
      1. On an existing Moodle instance with courses, upgrade your instance with the patch applied.
      2. Confirm that the upgrade completes successfully.
      Fresh installation
      1. Create a fresh install of Moodle with this patch.
      2. Confirm that installation completes successfully.
      Basic functionality
      1. Log in as an admin
      2. Set up a course
      3. Add a quiz with at least two questions
      4. Edit the questions and confirm there are no additional fields in the question edit forms.
      5. Go to Site administration / Plugins / Question bank plugins / Question custom fields
      6. Click "Add a new category"
      7. Confirm that a new category "Other fields" is added.
      8. Try to rename this category.
      9. Confirm that you can rename the category.
      10. Refresh the page.
      11. Confirm that the category name remains unchanged.
      12. Click "Add a new custom field"
      13. Confirm that you see the enabled custom field type plugins on the dropdown menu.
      14. Add at least two for each custom field type to the category. Set various settings for each custom field.
      15. Create another category and add each custom field types with various settings for each custom field.
      16. Go back to the course with the test quiz and test questions.
      17. Edit the questions and Confirm that the custom categories and fields that you have set up earlier are shown on the question edit form.
      18. Confirm that the input behaviours for each custom field are consistent with their settings. Examples:
        Setting Behaviour
        Required An error will be shown indicating that the field is required when the custom field is left empty.
        Unique data If you have two questions q1 and q2 you cannot use the same value for a custom field that has already been defined on the other course
        Locked If you are a teacher, you won't be able to edit the custom field. If you are a manager/admin, you should be able to.
      1. Attempt the quiz.
      2. Confirm that the custom fields that have been set are shown for each question in the quiz according to their visibility settings. For example,
        Visible to Expected
        Everyone Custom field value can be seen by everyone regardless of their role.
        Teachers Only users with the editing teacher role or above can view the custom field's value.
        Not visible The custom field's value won't be displayed at all (except admins)
      1. Preview the questions from the question bank
      2. Confirm the custom fields that have been set are shown for each question in the quiz according to their visibility settings.
      Backup and restore
      1. Backup a course with the quiz,
      2. Restore the backup as a new course.
      3. When editing the quiz in the new course Confirm that the custom field values for the questions are shown.
      4. Repeat the above, but just backup the quiz activity itself
      Deleting a custom field.
      1. Go to Site administration / Courses / Course custom fields
      2. Delete one of the defined custom fields.
      3. Go to the site home.
      4. Confirm that the values for the deleted custom field are no longer shown.

       

      Show
      Upgrade On an existing Moodle instance with courses, upgrade your instance with the patch applied. Confirm that the upgrade completes successfully. Fresh installation Create a fresh install of Moodle with this patch. Confirm that installation completes successfully. Basic functionality Log in as an admin Set up a course Add a quiz with at least two questions Edit the questions and confirm there are no additional fields in the question edit forms. Go to Site administration / Plugins / Question bank plugins / Question custom fields Click " Add a new category " Confirm that a new category "Other fields" is added. Try to rename this category. Confirm that you can rename the category. Refresh the page. Confirm that the category name remains unchanged. Click " Add a new custom field " Confirm that you see the enabled custom field type plugins on the dropdown menu. Add at least two for each custom field type to the category. Set various settings for each custom field. Create another category and add each custom field types with various settings for each custom field. Go back to the course with the test quiz and test questions. Edit the questions and Confirm that the custom categories and fields that you have set up earlier are shown on the question edit form. Confirm that the input behaviours for each custom field are consistent with their settings. Examples: Setting Behaviour Required An error will be shown indicating that the field is required when the custom field is left empty. Unique data If you have two questions q1 and q2 you cannot use the same value for a custom field that has already been defined on the other course Locked If you are a teacher, you won't be able to edit the custom field. If you are a manager/admin, you should be able to. Attempt the quiz. Confirm that the custom fields that have been set are shown for each question in the quiz according to their visibility settings. For example, Visible to Expected Everyone Custom field value can be seen by everyone regardless of their role. Teachers Only users with the editing teacher role or above can view the custom field's value. Not visible The custom field's value won't be displayed at all (except admins) Preview the questions from the question bank Confirm the custom fields that have been set are shown for each question in the quiz according to their visibility settings. Backup and restore Backup a course with the quiz, Restore the backup as a new course. When editing the quiz in the new course Confirm that the custom field values for the questions are shown. Repeat the above, but just backup the quiz activity itself Deleting a custom field. Go to Site administration / Courses / Course custom fields Delete one of the defined custom fields. Go to the site home. Confirm that the values for the deleted custom field are no longer shown.  

      Description

      Implement custom fields for questions using the Moodle custom fields API. This will allow teachers and question creators to store extra metadata against questions in a very flexible way. This is part of the epic MDL-70329.

      Data stored in question custom fields, can be shown to students during a quiz, or can be hidden and only shown to teachers etc.

       

      The data in the custom fields can also be leveraged by plugins in the new qbank_* plugin class.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mattp@catalyst-au.net Matt Porritt
              Reporter:
              mattp@catalyst-au.net Matt Porritt
              Peer reviewer:
              Tim Hunt Tim Hunt
              Integrator:
              Ilya Tregubov Ilya Tregubov
              Participants:
              Component watchers:
              Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated: