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

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8.7, 1.9.3
    • Component/s: Questions
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      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

              Assignee:
              ppichet Pierre Pichet
              Reporter:
              ppichet Pierre Pichet
              Tester:
              Nobody
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Oct/08