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

Decimal places of tolerance in numerical question type deleted when entered with comma

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.7
    • 2.9.3, 3.1.4, 3.2.1, 3.7
    • Questions
    • MOODLE_29_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_37_STABLE
    • MOODLE_37_STABLE
    • MDL-53140-master
    • Hide

      Setup

      1. Log in as admin.
      2. Customise the English language pack (Site administration > Language > Language customisation - English - langconfig.php) and set core_langconfig/decsep to a cmoma (,) and set  core_langconfig/thousandssep to a dot (.)
      3. Create a test course
      4. Go to the test course question bank.

      Testing numerical question editing

      1. Create a new 'Numerical' question.
      2. Fill the form with these:
        • Question name: q1
        • Question text: q1
        • Default mark: 1
        • Answer 1: 2.4
        • Error: 0.1
        • Answer 2: 3,5
        • Error: 0,1
        • Answer 3: 5.3,5
        • Error: 0.1,5
        • Answer 4: 7,3.5
        • Error: 0,1.5
        • Answer 5: 10,5
        • Error: 0g8
        • Answer 6: 15,5
        • Error: (blank)
      3. Do not set any mark for any of the answers and submit the form.
      4. After the form is redisplayed, verify that all the fields that you entered in step 2 still have the exact same value.
      5. Verify that the validation of Answer1, Answer 3, Answer 4 and Answer 5 fields have failed.
      6. Set the mark of the Answer1 to 100%.
      7. Change the error field of answer 3 to 0.15 and change the error field of answer 4 to 0,15 and change the error field of answer 5 to 0
      8. Submit the form.
      9. Verify that the question is created successfully.
      10. Edit the question you just created.
      11. Verify that the fields' value is as follows:
        • Question name: q1
        • Question text: q1
        • Default mark: 1
        • Answer 1: 2,4
        • Error: 0,1
        • Answer 2: 3,5
        • Error: 0,1
        • Answer 3: 5,35
        • Error: 0,15
        • Answer 4: 73,5
        • Error: 0,15
        • Answer 5: 10,5
        • Error: 0
        • Answer 6: 15,5
        • Error: (blank)

      Testing calculated question editing

      1. Create a new calculated question
      2. Fill the form with these:
        • Question name: q2
        • Question text: {x}+{y} is ...?
        • Answer 1 formula: {x}+{y}
        • Tolerance: 0.01
        • Answer 2 formula: {x}*{y}
        • Tolerance: 0,01
        • Answer 3 formula: {x}-{y}
        • Tolerance: nan
      3. Do not set any mark for any of the answers and submit the form.
      4. After the form is redisplayed, verify that all the fields that you entered in step 2 still have the exact same value.
      5. Verify that the validation of Answer 1 and Answer 3 have failed.
      6. Set the mark of the Answer1 to 100%.
      7. Set the tolerance of Answer3 to 0,01
      8. Submit the form
      9. On the next screen, just click on the next page button.
      10. Verify that all numbers in the "Item to add" section are using "," as the decimal separator
      11. Click on the "Add" button at the bottom of the page
      12. Verify that the new 2 text fields that are added at the bottom of the page contain numbers with "," as the decimal point
      13. Click on the "Add" button again
      14. Set the number that is next to the "Display" button to 10, and then click on the "Display" button
      15. Verify that all text fields that are in "Set 1" and "Set 2" sections contain numbers with "," as the decimal point
      16. Click on the "Sae changes" button
      17. Verify that the question is created successfully
      18. Edit the question you just created
      19. Verify the following fields equal to what is expected
        • Answer 1 tolerance: 0,01
        • Answer 2 tolerance: 0,01
        • Answer 3 tolerance: 0,01

      Testing calculated simple question editing

      1. Create a new calculated simple question
      2. Fill the form with these:
        • Question name: q2
        • Question text: {x}+{y} is ...?
        • Answer 1 formula: {x}+{y}
        • Tolerance: 0.01
        • Answer 2 formula: {x}*{y}
        • Tolerance: 0,01
        • Answer 3 formula: {x}-{y}
        • Tolerance: nan
      3. Do not set any mark for any of the answers and click on the "save changes" button.
      4. After the form is redisplayed, verify that all the fields that you entered in step 2 still have the exact same value.
      5. Verify that the validation of Answer 1 and Answer 3 have failed.
      6. Set the mark of the Answer1 to 100%.
      7. Set the tolerance of Answer3 to 0,01
      8. Click on the "Find the wild cards {x..} present in the correct answer formulas" button
      9. Click on the "Generate" button to generate 1 new set of wild card values
      10. Expand the "Wild card(s) values" section and then click on "show more..."
      11. Verify that the new 2 text fields that are added at the bottom of the page contain numbers with "," as the decimal point
      12. Set the field that is next to the generate button to 10 and then click on the "Generate" button again to generate 10 new set of wild card values
      13. Set the number that is next to the "Display" button to 10, and then click on the "Display" button
      14. Verify that all text fields that are within the "Wild card(s) values" section contain numbers with "," as the decimal point
      15. Click on the save changes button
      16. Verify that the question is saved successfully
      17. Edit the question you just created
      18. Verify the following fields equal to what is expected
        • Answer 1 tolerance: 0,01
        • Answer 2 tolerance: 0,01
        • Answer 3 tolerance: 0,01

      Export and Import

      1. Hopefully, you now have a numerical question and three different types of question in a category in the question bank.
      2. Export that category in Moodle XML format.
      3. Open the file in your text editor, and verify that all the numerical values in the file (except perhaps for the answers themselves, which have not been changed here) are exported using . as decimal separator.
      4. In the question bank for your test course, make a new category called 'Import test'
      5. Import the questions you just exported into that category (expand the General section of the import form to do this).
      6. Edit each of the questions, and verify that all the numerical values have been imported correctly.
      Show
      Setup Log in as admin. Customise the English language pack (Site administration > Language > Language customisation - English - langconfig.php) and set core_langconfig/decsep to a cmoma (,) and set  core_langconfig/thousandssep to a dot (.) Create a test course Go to the test course question bank. Testing numerical question editing Create a new 'Numerical' question. Fill the form with these: Question name: q1 Question text: q1 Default mark: 1 Answer 1: 2.4 Error: 0.1 Answer 2: 3,5 Error : 0,1 Answer 3 : 5.3,5 Error : 0.1,5 Answer 4: 7,3.5 Error : 0,1.5 Answer 5: 10,5 Error :  0g8 Answer 6: 15,5 Error: (blank) Do not set any mark for any of the answers and submit the form. After the form is redisplayed, verify that all the fields that you entered in step 2 still have the exact same value. Verify that the validation of Answer1 , Answer 3 , Answer 4 and Answer 5 fields have failed. Set the mark of the Answer1 to 100%. Change the error field of answer 3 to 0.15  and change the error field of answer 4 to 0,15 and change the error field of answer 5 to 0 Submit the form. Verify that the question is created successfully. Edit the question you just created. Verify that the fields' value is as follows: Question name: q1 Question text: q1 Default mark: 1 Answer 1: 2,4 Error: 0,1 Answer 2: 3,5 Error : 0,1 Answer 3 : 5,35 Error : 0,15 Answer 4: 73,5 Error : 0,15 Answer 5: 10,5 Error :  0 Answer 6: 15,5 Error: (blank) Testing calculated question editing Create a new calculated question Fill the form with these: Question name: q2 Question text: {x}+{y} is ...? Answer 1 formula:  {x}+{y} Tolerance: 0.01 Answer 2 formula:  {x}*{y} Tolerance: 0,01 Answer 3 formula: {x}-{y} Tolerance: nan Do not set any mark for any of the answers and submit the form. After the form is redisplayed, verify that all the fields that you entered in step 2 still have the exact same value. Verify that the validation of Answer 1 and  Answer 3 have failed. Set the mark of the Answer1 to 100%. Set the tolerance of Answer3 to 0,01 Submit the form On the next screen, just click on the next page button. Verify that all numbers in the "Item to add" section are using "," as the decimal separator Click on the "Add" button at the bottom of the page Verify that the new 2 text fields that are added at the bottom of the page contain numbers with "," as the decimal point Click on the "Add" button again Set the number that is next to the "Display" button to 10, and then click on the "Display" button Verify that all text fields that are in "Set 1" and "Set 2" sections contain numbers with "," as the decimal point Click on the "Sae changes" button Verify that the question is created successfully Edit the question you just created Verify the following fields equal to what is expected Answer 1 tolerance: 0,01 Answer 2 tolerance: 0,01 Answer 3 tolerance: 0,01 Testing calculated simple question editing Create a new calculated simple question Fill the form with these: Question name: q2 Question text: {x}+{y} is ...? Answer 1 formula:  {x}+{y} Tolerance: 0.01 Answer 2 formula:  {x}*{y} Tolerance: 0,01 Answer 3 formula: {x}-{y} Tolerance: nan Do not set any mark for any of the answers and click on the "save changes" button. After the form is redisplayed, verify that all the fields that you entered in step 2 still have the exact same value. Verify that the validation of Answer 1 and  Answer 3 have failed. Set the mark of the Answer1 to 100%. Set the tolerance of Answer3 to 0,01 Click on the "Find the wild cards {x..} present in the correct answer formulas" button Click on the "Generate" button to generate 1 new set of wild card values Expand the "Wild card(s) values" section and then click on "show more..." Verify that the new 2 text fields that are added at the bottom of the page contain numbers with "," as the decimal point Set the field that is next to the generate button to 10 and then click on the "Generate" button again to generate 10 new set of wild card values Set the number that is next to the "Display" button to 10, and then click on the "Display" button Verify that all text fields that are within the "Wild card(s) values" section contain numbers with "," as the decimal point Click on the save changes button Verify that the question is saved successfully Edit the question you just created Verify the following fields equal to what is expected Answer 1 tolerance: 0,01 Answer 2 tolerance: 0,01 Answer 3 tolerance: 0,01 Export and Import Hopefully, you now have a numerical question and three different types of question in a category in the question bank. Export that category in Moodle XML format. Open the file in your text editor, and verify that all the numerical values in the file (except perhaps for the answers themselves, which have not been changed here) are exported using . as decimal separator. In the question bank for your test course, make a new category called 'Import test' Import the questions you just exported into that category (expand the General section of the import form to do this). Edit each of the questions, and verify that all the numerical values have been imported correctly.

      Problem
      If the tolerance (error) of an answer in numerical questions is entered using a comma as decimal separator (e.g. 1,25) decimal places are deleted when saving the question (e.g. 1,25 becomes 1). Saving of the numerical question works fine so teachers don't know about the deleted decimal places. As a result of the deleted decimal places, answers that should be within the specified tolerance are marked as wrong.

      Expected behavior
      When the language of the course / chosen by the user is set to German I would expect that Moodle accepts comma as decimal separator also for tolerance in numerical question types.

      If this is not possible I would expect that Moodle throws an error message when saving instead of just deleting decimal places.

      How to reproduce

      1. In a Moodle course choose German as language
      2. Create a numerical question and enter the tolerance with comma as decimal separator (e. g. 1,25)
      3. Save the question
      4. Reopen the question: the tolerance should have no decimal places anymore

        1. edit_numerical_form.png
          edit_numerical_form.png
          17 kB
        2. different fields.png
          different fields.png
          2 kB
        3. answer_fields_numerical_form.png
          answer_fields_numerical_form.png
          21 kB
        4. 1.png
          1.png
          129 kB
        5. 2.png
          2.png
          150 kB
        6. 4b.png
          4b.png
          192 kB
        7. 3.png
          3.png
          264 kB
        8. 4a.png
          4a.png
          845 kB

            rezaie9 Shamim Rezaie
            a.bonaccorso Antonia Bonaccorso
            Simey Lameze Simey Lameze
            Adrian Greeve Adrian Greeve
            Janelle Barcega Janelle Barcega
            Votes:
            22 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 days
                4d

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.