mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-67151 qtype_numerical: Support for the scientific format
This commit is contained in:
parent
35ca1475b5
commit
bb8d19b885
@ -212,7 +212,7 @@ class qtype_numerical_edit_form extends question_edit_form {
|
||||
$question->tolerance[$key] = $answer->tolerance;
|
||||
|
||||
if (is_numeric($question->answer[$key])) {
|
||||
$question->answer[$key] = format_float($question->answer[$key], strlen($question->answer[$key]), true, true);
|
||||
$question->answer[$key] = format_float($question->answer[$key], -1);
|
||||
}
|
||||
|
||||
$key++;
|
||||
|
@ -20,14 +20,14 @@ Feature: Test editing a Numerical question
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | template |
|
||||
| Test questions | numerical | Numerical for editing | pi |
|
||||
And the following "language customisations" exist:
|
||||
|
||||
Scenario: Edit a Numerical question when using a custom decimal separator
|
||||
Given the following "language customisations" exist:
|
||||
| component | stringid | value |
|
||||
| core_langconfig | decsep | # |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Question bank" in current page administration
|
||||
|
||||
Scenario: Edit a Numerical question
|
||||
When I choose "Edit question" action for "Numerical for editing" in the question bank
|
||||
Then the field "id_answer_0" matches value "3#14"
|
||||
When I set the following fields to these values:
|
||||
@ -47,3 +47,17 @@ Feature: Test editing a Numerical question
|
||||
| id_answer_3 | 3,01 |
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Edited Numerical name"
|
||||
|
||||
Scenario: Edit a Numerical question with very small answer
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Question bank" in current page administration
|
||||
When I choose "Edit question" action for "Numerical for editing" in the question bank
|
||||
And I set the following fields to these values:
|
||||
| id_answer_0 | 0.00000123456789 |
|
||||
| id_tolerance_1 | 0.0000123456789 |
|
||||
And I press "id_submitbutton"
|
||||
And I choose "Edit question" action for "Numerical for editing" in the question bank
|
||||
Then the following fields match these values:
|
||||
| id_answer_0 | 0.00000123456789 |
|
||||
| id_tolerance_1 | 0.0000123456789 |
|
||||
|
Loading…
x
Reference in New Issue
Block a user