Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-31680

Calculated correct response does not apply the format set (significant figure or decimals)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.1.4, 2.2.1
    • 2.6
    • Questions
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_26_STABLE
    • Hide

      Create a calculated question using a simple equation like

      {x}+0.012345 set the response to 2 decimals
      generate a {x}

      value between 10 and 90 (no decimal) say 45.
      The good response should 45.01 and the same value should show when looking at the wild card value.
      Attempt the saved question, the fill correct response should display the same value and on submit and finish the correct answer should also agree.

      Repeat the tets with 1 decimals. The correct answer should be 45.0 .

      Add a unit say cm and the numerical value displayed should remain the same.

      Add another unit say m multiplier 0.01 and try with the two options for unit (multiple choice or drop-down list)
      The decimal should remain the same either when filling the corect response or in the correct response at the end.
      Do some test with calculated simple.

      The set the option to 4 significant figures. The values displayed should be
      the same as when setting to significant figures.
      Do the tests ( looking at the values for the wild cards values as when doing the previews.
      The https://tracker.moodle.org/secure/attachment/31662/questions-CHI0310_100-test%20MDL-31680-20130313-1325.xml
      contains many questions that illustrate various cases most of them are reproduced in the php test unit.

      The https://tracker.moodle.org/secure/attachment/32775/questions-T1-IMPORT%20MDL-31680-20130515-2347.xml contains three questions with long answers that illustrate their rendering when editing at the datasetitems_form.php for calculated and calculatedmulti
      you should see something like for

      • datasetitems_form.php for calculatedmulti

          
        La componente es ... La componente es {=(123456786.*pow(123456781.1,2)+1234567890.4*123456786.+123456781.1*1234567890.4)/(pow(123456781.1,2)+pow(123456786.,2))}
        

        The left part is truncated ... but the right one not

      • datasetitems_form.php for calculated or in edit_calculated_simple_form.php

        Set 1  {x}+{x}+{x}+{x}+{...
        123456789+123456789+123456789+123456789+123456789+1234567... = 9.88e8
        

      Additional validation has been added when entering new param values:
      error will appear on

      • adding a , in a number : 1,2 gives The , cannot be used, use . as in 0.013 or 1.3e-2
      • adding a non valid number : E-12cm gives Wild card value is not a valid number
      • adding an hexadecimal : 0X13D gives Dataset hexadecimal format value 0X13D is not allowed

      An additional test is done if the formula give a NAN result which result is a non valid number.

      These validation will appears if after entering one of these error in a wildcard value
      you click on the Add item or on save button for

      • datasetitems_form.php for calculated and calculatedmulti
      • and in edit_calculated_simple_form.php.
      Show
      Create a calculated question using a simple equation like {x}+0.012345 set the response to 2 decimals generate a {x} value between 10 and 90 (no decimal) say 45. The good response should 45.01 and the same value should show when looking at the wild card value. Attempt the saved question, the fill correct response should display the same value and on submit and finish the correct answer should also agree. Repeat the tets with 1 decimals. The correct answer should be 45.0 . Add a unit say cm and the numerical value displayed should remain the same. Add another unit say m multiplier 0.01 and try with the two options for unit (multiple choice or drop-down list) The decimal should remain the same either when filling the corect response or in the correct response at the end. Do some test with calculated simple. The set the option to 4 significant figures. The values displayed should be the same as when setting to significant figures. Do the tests ( looking at the values for the wild cards values as when doing the previews. The https://tracker.moodle.org/secure/attachment/31662/questions-CHI0310_100-test%20MDL-31680-20130313-1325.xml contains many questions that illustrate various cases most of them are reproduced in the php test unit. The https://tracker.moodle.org/secure/attachment/32775/questions-T1-IMPORT%20MDL-31680-20130515-2347.xml contains three questions with long answers that illustrate their rendering when editing at the datasetitems_form.php for calculated and calculatedmulti you should see something like for datasetitems_form.php for calculatedmulti La componente es ... La componente es {=(123456786.*pow(123456781.1,2)+1234567890.4*123456786.+123456781.1*1234567890.4)/(pow(123456781.1,2)+pow(123456786.,2))} The left part is truncated ... but the right one not datasetitems_form.php for calculated or in edit_calculated_simple_form.php Set 1 {x}+{x}+{x}+{x}+{... 123456789+123456789+123456789+123456789+123456789+1234567... = 9.88e8 Additional validation has been added when entering new param values: error will appear on adding a , in a number : 1,2 gives The , cannot be used, use . as in 0.013 or 1.3e-2 adding a non valid number : E-12cm gives Wild card value is not a valid number adding an hexadecimal : 0X13D gives Dataset hexadecimal format value 0X13D is not allowed An additional test is done if the formula give a NAN result which result is a non valid number. These validation will appears if after entering one of these error in a wildcard value you click on the Add item or on save button for datasetitems_form.php for calculated and calculatedmulti and in edit_calculated_simple_form.php.

    Description

      The correct response displayed i.e. 2,78023456 is not set as defined when setting the correct answer.
      see http://moodle.org/mod/forum/discuss.php?d=188637

      Attachments

        Issue Links

          Activity

            People

              ppichet Pierre Pichet
              ppichet Pierre Pichet
              Tim Hunt Tim Hunt
              Dan Poltawski Dan Poltawski
              Andrew Davis Andrew Davis
              Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                18/Nov/13