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

Implement extra_answer_fields

    XMLWordPrintable

Details

    • MOODLE_20_STABLE, MOODLE_26_STABLE
    • MOODLE_27_STABLE
    • Hide

      This code main function is to help 3rd party question types. So probably the best way to test it is to install Preg question type from attached archive preg_25_rc.zip and run question/type/preg/tests/questiontype_test.php which contains advanced tests for user manipulating with both answers and extra_answers_fields. Preg uses options extra_answer_fields, that gives more testing cases than anything else.

      However, if you don't want to install additional question types, you could test it using shortanswer question.

      1. Create shortanswer question with 5 answers.
      2. Edit question and see that all 5 answers are in their place on the edit form.
      3. Clear 1-st, 3-rd and 5-th answers (you need to clear all answer, fraction and feedback fields to do it) and save question.
      4. Edit question and see there are 2 answers on form now (that was 2-nd and 4-th before).
      5. Add two new answers in the end and save question.
      6. Open question to edit and see that it contains 4 answers for now.
      7. Delete 2-nd and add new answer, saving form.
      8. Open question to edit and see that there are 4 answers: the ones that were 1-st, 3-rd and 4-th on the 6. step and the new one added there.

      Show
      This code main function is to help 3rd party question types. So probably the best way to test it is to install Preg question type from attached archive preg_25_rc.zip and run question/type/preg/tests/questiontype_test.php which contains advanced tests for user manipulating with both answers and extra_answers_fields. Preg uses options extra_answer_fields, that gives more testing cases than anything else. However, if you don't want to install additional question types, you could test it using shortanswer question. 1. Create shortanswer question with 5 answers. 2. Edit question and see that all 5 answers are in their place on the edit form. 3. Clear 1-st, 3-rd and 5-th answers (you need to clear all answer, fraction and feedback fields to do it) and save question. 4. Edit question and see there are 2 answers on form now (that was 2-nd and 4-th before). 5. Add two new answers in the end and save question. 6. Open question to edit and see that it contains 4 answers for now. 7. Delete 2-nd and add new answer, saving form. 8. Open question to edit and see that there are 4 answers: the ones that were 1-st, 3-rd and 4-th on the 6. step and the new one added there.

    Description

      Implement completely extra_answer_fields functionality to facilitate adding new fields to the answer blank. Will be good for PREG 2.0 version.

      Numerical question would be used as test and example if Tim doesn't have anything against this.

      The patch is going to be for 2.0 only.

      Attachments

        1. extra_answer_options.diff
          42 kB
          Stanislav Zhorin

        Issue Links

          Activity

            People

              oa_sychev Oleg Sychev
              oa_sychev Oleg Sychev
              Tim Hunt Tim Hunt
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Michael de Raadt Michael de Raadt
              Safat Shahin, Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                12/May/14