BLD-525: Fix Numerical input to support mathematical operations.
This commit is contained in:
@@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes,
|
||||
in roughly chronological order, most recent first. Add your entries at or near
|
||||
the top. Include a label indicating the component affected.
|
||||
|
||||
Blades: Fix Numerical input to support mathematical operations. BLD-525.
|
||||
|
||||
Blades: Improve calculator's tooltip accessibility. Add possibility to navigate
|
||||
through the hints via arrow keys. BLD-533.
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ describe 'MarkdownEditingDescriptor', ->
|
||||
= 3.14159 +- .02
|
||||
|
||||
Enter the approximate value of 502*9:
|
||||
= 4518 +- 15%
|
||||
= 502*9 +- 15%
|
||||
|
||||
Enter the number of fingers on a human hand:
|
||||
= 5
|
||||
@@ -125,7 +125,7 @@ describe 'MarkdownEditingDescriptor', ->
|
||||
</numericalresponse>
|
||||
|
||||
<p>Enter the approximate value of 502*9:</p>
|
||||
<numericalresponse answer="4518">
|
||||
<numericalresponse answer="502*9">
|
||||
<responseparam type="tolerance" default="15%" />
|
||||
<formulaequationinput />
|
||||
</numericalresponse>
|
||||
|
||||
@@ -234,12 +234,14 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
|
||||
floatValue = parseFloat(answersList[0]);
|
||||
|
||||
if(!isNaN(floatValue)) {
|
||||
var params = /(.*?)\+\-\s*(.*?$)/.exec(answersList[0]);
|
||||
var params = /(.*?)\+\-\s*(.*?$)/.exec(answersList[0]),
|
||||
answer = answersList[0].replace(/\s+/g, '');
|
||||
if(params) {
|
||||
string = '<numericalresponse answer="' + floatValue + '">\n';
|
||||
answer = params[1].replace(/\s+/g, '');
|
||||
string = '<numericalresponse answer="' + answer + '">\n';
|
||||
string += ' <responseparam type="tolerance" default="' + params[2] + '" />\n';
|
||||
} else {
|
||||
string = '<numericalresponse answer="' + floatValue + '">\n';
|
||||
string = '<numericalresponse answer="' + answer + '">\n';
|
||||
}
|
||||
string += ' <formulaequationinput />\n';
|
||||
string += '</numericalresponse>\n\n';
|
||||
|
||||
Reference in New Issue
Block a user