Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
8f013871
Commit
8f013871
authored
Dec 02, 2013
by
polesye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BLD-525: Fix Numerical input to support mathematical operations.
parent
45d373c2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
CHANGELOG.rst
+2
-0
common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee
+2
-2
common/lib/xmodule/xmodule/js/src/problem/edit.coffee
+5
-3
No files found.
CHANGELOG.rst
View file @
8f013871
...
...
@@ -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.
...
...
common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee
View file @
8f013871
...
...
@@ -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>
...
...
common/lib/xmodule/xmodule/js/src/problem/edit.coffee
View file @
8f013871
...
...
@@ -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
'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment