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

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: None
    • Component/s: Questions
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE
    • Rank:
      3465

      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.

        Activity

        Hide
        Pierre Pichet added a comment -

        resolve when multianswer was implemented in calculated question

        Show
        Pierre Pichet added a comment - resolve when multianswer was implemented in calculated question

          People

          • Assignee:
            Pierre Pichet
            Reporter:
            Pierre Pichet
            Participants:
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: