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

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

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

              Dates

              Created:
              Updated:
              Resolved: