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

Numerical question answer and tolerance round last digit, each time I save the values until entire number is gone

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.7.2, 3.8, 3.9
    • 3.7.4, 3.8.1
    • Questions, Quiz
    • MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • MDL-67151-master
    • Hide

      Test: Calculated questions

      1. Log in as admin and go to Site home
      2. From the cog icon, go to More... > Question bank > Questions
      3. Create a calculated question with the following:
        • Answer 1 formula: {x}*2
        • Grade: 100%
        • Answer display: 9 decimals
      4. Accept the defaults on the "choose wildcard dataset properties" page and click on the "Next page" button
      5. At the "Item to add" section, enter the following
        • Wild card {x}: 0.000001231
        • Minimum: 0.00000123
        • Maximum: 0.00000124
        • Decimal places: 9
      6. Click on the "Update the datasets parameters" button at the top of the page
      7. At the bottom of the page, set the "Add items" field to10 and click on the "Add" button
      8. set the display field to "10" and then click on the "Display" button
      9. Take a note of the "Wild card {x}" value for "Set 9".
        • Important: if the number of decimals for this value is less than 9, then take the value for "set 8". If the numbers of decimals for value in "set 8" is again less than 9 decimals, then take the value in "set 7", etc
      10. Click on the "Save changes" button to finalise the creation of question
      11. Edit the question you created again.
      12. Click on the "Save changes" button without changing anything on the form
      13. Click on the "Next page" button
      14. When the next page is loaded, view the page source (it is safe to reload the page if needed)
      15. Verify that the value of "number[9]" hidden input field is what you recorded at step 9. They should have equal numeric values. It is ok if one of them is in scientific notation.
        • Important: if at step 9, you had to take the value for "set 8", then here check the value of "number[8]". If "set 7 then "number[7]", etc.
      Show
      Test: Calculated questions Log in as admin and go to Site home From the cog icon, go to More... > Question bank > Questions Create a calculated question with the following: Answer 1 formula:  {x}*2 Grade: 100% Answer display: 9 decimals Accept the defaults on the "choose wildcard dataset properties" page and click on the "Next page" button At the "Item to add" section, enter the following Wild card {x}:  0.000001231 Minimum:  0.00000123 Maximum:  0.00000124 Decimal places: 9 Click on the "Update the datasets parameters" button at the top of the page At the bottom of the page, set the "Add items" field to10 and click on the "Add" button set the display field to "10" and then click on the "Display" button Take a note of the "Wild card {x}" value for "Set 9". Important: if the number of decimals for this value is less than 9, then take the value for "set 8". If the numbers of decimals for value in "set 8" is again less than 9 decimals, then take the value in "set 7", etc Click on the "Save changes" button to finalise the creation of question Edit the question you created again. Click on the "Save changes" button without changing anything on the form Click on the "Next page" button When the next page is loaded, view the page source (it is safe to reload the page if needed) Verify that the value of "number [9] " hidden input field is what you recorded at step 9. They should have equal numeric values. It is ok if one of them is in scientific notation. Important: if at step 9, you had to take the value for "set 8", then here check the value of "number [8] ". If "set 7 then "number [7] ", etc.

    Description

      It seems we have a regression caused by switching from text to float values in Numerical question Answers and Tolerance form fields during the improvements introduced by MDL-53140.

      When using the following values in the Answer and the Tolerance of a Numerical question in a quiz, and saving the question settings form values... the form fields with answers and tolerance that hold float numbers with more than 4 leading zeros to the right side of the floating point keep rounding the last digit, and with repetitive "save" actions dissolve the entire float number to zero.

      For example:

      (Answer with 5 leading zeros, and Tolerance with 4 leading zeros)

      Answer Tolerance 
      0.00000123456789 0.0000123456789
      0.0000012345679 0.000012345679
      0.000001234568 0.00001234568
      0.00000123457 0.0000123457
      0.0000012346 0.000012346
      0.000001235 0.00001235
      0.00000124 0.0000124
      0.0000012 0.000012
      0.000001 0.00001
      0.00000 0.0000
      0 0

      When using Answer with 4 leading zeros, and Tolerance with 3 leading zeros, the values are kept between recurring saves.

      Attachments

        1. testing37.png
          testing37.png
          59 kB
        2. testing38.png
          testing38.png
          53 kB
        3. testing39.png
          testing39.png
          58 kB

        Issue Links

          Activity

            People

              rezaie9 Shamim Rezaie
              nadavkav Nadav Kavalerchik
              Tim Hunt Tim Hunt
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Safat Shahin, Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                13/Jan/20

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 days, 46 minutes
                  3d 46m