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

XMLWordPrintable

#### Details

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

## Setup

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
• Error: 0.1
• Error: 0,1
• Error: 0.1,5
• Error: 0,1.5
• Error: 0g8
• 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.
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
• Error: 0,1
• Error: 0,1
• Error: 0,15
• Error: 0,15
• Error: 0
• 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 ...?
• Tolerance: 0.01
• Tolerance: 0,01
• 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

## 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 ...?
• Tolerance: 0.01
• Tolerance: 0,01
• 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

## 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

#### Description

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

#### Attachments

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

#### People

Shamim Rezaie
Antonia Bonaccorso
Simey Lameze
Janelle Barcega
22 Vote for this issue
Watchers:
13 Start watching this issue

#### Dates

Created:
Updated:
Resolved:

#### Time Tracking

Estimated:
Not Specified
Remaining:
0m
Logged:
4d