Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-8389 Calculated question: user interface when creating or editing a question
  3. MDL-8447

The default answer fraction is not settled correctly on the edit_calculated form, a solution is proposed

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8
    • None
    • Questions
    • None
    • MOODLE_18_STABLE

    Description

      On building the edit_calculated_form.php , the default answer[0] fraction is set to 1 which is the correct value
      line 75 of edit_calculated_form.php
      $mform->addElement('hidden', 'fraction[0]', 1);
      however at line 76 there is another line to setConstants
      $mform->setConstants(array('fraction[0]'=>PARAM_INT));
      written this way the final result on the input form is
      <input name="fraction[0]" type="hidden" value="2" />
      if we comment line 76
      // $mform->setConstants(array('fraction[0]'=>PARAM_INT));
      the result is the one expected
      <input name="fraction[0]" type="hidden" value="1" />

      And the value stored in question_answers table is the right one, the preview.php is working correctly etc.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: