Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-8473 Numerical question: bugs and improvements
  3. MDL-8475

The new 1.8 interface does not handle well the delete of unused answers

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8
    • 1.8.7, 1.9.3
    • Questions
    • None
    • MOODLE_18_STABLE
    • MOODLE_18_STABLE, MOODLE_19_STABLE

    Description

      When you save a numerical answer the unused answers set to null remain with 0 as default and new ones are added.
      This can be solved by
      EITHER
      removing the line 30 of edit_numerical_form.php
      $mform->setType('answer', PARAM_NUMBER);
      because the 'answer' default to "0" when set as a param_number and the test line 117 of numerical/questiontype.php
      if ($dataanswer != '' || trim($question->feedback[$key])) {
      does not work.
      As the "0" default is a valid numerical answer removing the setType give a first partial solution.
      OR by handling the problem differently i.e.
      adding a new checkbox that explicitly ask for the delete an unused answer (line 28 of edit_numerical_form.php)
      $repeated[] =& $mform->createElement('checkbox', 'deleteanswer', get_string('delete this answer when saving question', 'qtype_numerical', '

      {no}

      '));
      and other lines in the validation process of edit_numerical_form.php and numerical/questiontype.php
      A solution has been worked for this option and the code will be made available after more complete testing.
      The validation process has also been extended to grade validation ( at least on 100% graded answer) as was reported by MDL-8094

      Attachments

        Issue Links

          Activity

            People

              ppichet Pierre Pichet
              ppichet Pierre Pichet
              Nobody Nobody
              Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/Oct/08