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

Questions: Default options when creating a question

XMLWordPrintable

    • MOODLE_311_STABLE
    • Hide

      Testing needs to be done for the following question types:

      • Multiple choice (qtype_multichoice)
      • short answer (qtype_shortanswer)
      • Drag and drop into text (qtype_ddwtos)
      • Select missing words (qtype_gapselect)

      For testing you need a Moodle course and at least two users who can create questions.

      1. Create a Moodle course
      2. Create two user (eg. editingteacher), teacher 1and teacher2.
      3. Enrol teacher1 and teacher2 in the your course
      4. login as teacher1 in to this course
      5. Go to the question bank
      6. Press on "Create a new question ..." button
      7. Choose a Multiple choice question and press the "Add" button
      8. While filling the question fields, make a note of the original default value of ‘Default mark’, ‘One or multiple answers?’, ‘Shuffle the choices?’, ‘Number the choices?’, ‘Show standard instructions’ fields, then change the values of these fields and remember them
      9. Press on "Create a new question ..." button again
      10. Choose a Multiple choice question and press the "Add" button (.. another Multiple choice)
      11. *Verify" that the values of the fields you have changed in previous Multiple choice question appear on the form as defaults.

      In other words, when user create a new question and modify some default setting, they are saved as user preference, so that the next time when a new question of the same type is created by the same user, the default values are taken from the user_preferences table for this user. I.e, teacher1 gets their preference as defaults for a new Multiple choice question, whereas teacher2 will get original default values.

      The testing can be done in the same way for:

      • qtype_shortanswer with 'Default mark' and 'Case sensitivity' fields;
      • qtype_ddwtos with 'Default mark' and 'Shuffle' fields;
      • qtype_gapselect with 'Default mark' and 'Shuffle' fields;
      Show
      Testing needs to be done for the following question types: Multiple choice (qtype_multichoice) short answer (qtype_shortanswer) Drag and drop into text (qtype_ddwtos) Select missing words (qtype_gapselect) For testing you need a Moodle course and at least two users who can create questions. Create a Moodle course Create two user (eg. editingteacher), teacher 1and teacher2. Enrol teacher1 and teacher2 in the your course login as teacher1 in to this course Go to the question bank Press on "Create a new question ..." button Choose a Multiple choice question and press the "Add" button While filling the question fields, make a note of the original default value of ‘Default mark’, ‘One or multiple answers?’, ‘Shuffle the choices?’, ‘Number the choices?’, ‘Show standard instructions’ fields, then change the values of these fields and remember them Press on "Create a new question ..." button again Choose a Multiple choice question and press the "Add" button (.. another Multiple choice) *Verify" that the values of the fields you have changed in previous Multiple choice question appear on the form as defaults. In other words, when user create a new question and modify some default setting, they are saved as user preference, so that the next time when a new question of the same type is created by the same user, the default values are taken from the user_preferences table for this user. I.e, teacher1 gets their preference as defaults for a new Multiple choice question, whereas teacher2 will get original default values . The testing can be done in the same way for: qtype_shortanswer with 'Default mark' and 'Case sensitivity' fields; qtype_ddwtos with 'Default mark' and 'Shuffle' fields; qtype_gapselect with 'Default mark' and 'Shuffle' fields;

      Of course, other people will want different defaults. Ordering already has a feature where it remembers the last settings the author made, automatically applying them to the next Ordering question. We want to do the same for other settings and other question types. This will speed things up significantly. for people creating many similar questions (see Moodle forum: https://moodle.org/mod/forum/discuss.php?d=417341).

      Teachers create lots of questions on various types in Moodle, some of which have repeatedly similar default settings form elements such as ‘Default mark’, ‘One or multiple answers?’, ‘Shuffle the choices?’, ‘Number the choices?’, ‘Show standard instructions’ (in qtype_multichoice), etc.

      On the way for Moodle3.11 there are 3 new methods in question/type/questiontypebase.php get_default_value(), set_default_value() and save_defaults_for_new_questions().

      get_default_value(), if needed, used in the edit_

      {qtypename}_form.php when using $mform->setDefault().

      save_defaults_for_new_questions() if needed, is implemented in {qtypename}

      /questiontype.php which calls the parent's method and then set_default_value() for each form element, where we used get_default_value() in edit_

      {qtypename}

      _form.php. Obviousely, if get_default_value() was not used, then there is no need to implement save_defaults_for_new_questions() method.

        1. teacher1_ddwtos.png
          758 kB
          Huong Nguyen
        2. teacher1_gapselect.png
          900 kB
          Huong Nguyen
        3. teacher1_multichoice.png
          869 kB
          Huong Nguyen
        4. teacher1_shortanswer.png
          459 kB
          Huong Nguyen
        5. teacher2.png
          1.38 MB
          Huong Nguyen

            mkassaei Mahmoud Kassaei
            mkassaei Mahmoud Kassaei
            Tim Hunt Tim Hunt
            Jun Pataleta Jun Pataleta
            Huong Nguyen Huong Nguyen
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 7 hours
                7h

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