Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
1e0c3f49
Commit
1e0c3f49
authored
Aug 01, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixup: do not show NaN in student training labels
parent
00d6a0e5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
7 deletions
+38
-7
openassessment/xblock/static/js/openassessment-studio.min.js
+0
-0
openassessment/xblock/static/js/spec/studio/oa_edit_listeners.js
+23
-0
openassessment/xblock/static/js/src/studio/oa_container_item.js
+14
-7
openassessment/xblock/static/js/src/studio/oa_edit_listeners.js
+1
-0
No files found.
openassessment/xblock/static/js/openassessment-studio.min.js
View file @
1e0c3f49
This diff is collapsed.
Click to expand it.
openassessment/xblock/static/js/spec/studio/oa_edit_listeners.js
View file @
1e0c3f49
...
@@ -79,6 +79,29 @@ describe("OpenAssessment.StudentTrainingListener", function() {
...
@@ -79,6 +79,29 @@ describe("OpenAssessment.StudentTrainingListener", function() {
);
);
});
});
it
(
"updates the label of an option with invalid points"
,
function
()
{
// If an option has invalid points, the points will be set to NaN
listener
.
optionUpdated
({
criterionName
:
"criterion_with_two_options"
,
name
:
"option_1"
,
label
:
"This is a new label!"
,
points
:
NaN
});
// Invalid points should be labeled as such
assertExampleLabels
(
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not Scored"
,
option_1
:
"This is a new label!"
,
option_2
:
"Good - 2 points"
}
}
);
});
it
(
"removes an option and displays an alert"
,
function
()
{
it
(
"removes an option and displays an alert"
,
function
()
{
// Initial state, set by the fixture
// Initial state, set by the fixture
assertExampleLabels
(
assertExampleLabels
(
...
...
openassessment/xblock/static/js/src/studio/oa_container_item.js
View file @
1e0c3f49
...
@@ -39,19 +39,26 @@ OpenAssessment.ItemUtilities = {
...
@@ -39,19 +39,26 @@ OpenAssessment.ItemUtilities = {
}
}
var
singularString
=
label
+
" - "
+
points
+
" point"
;
var
singularString
=
label
+
" - "
+
points
+
" point"
;
var
multipleString
=
label
+
" - "
+
points
+
" points"
;
var
multipleString
=
label
+
" - "
+
points
+
" points"
;
// If the option doesn't have a data points value, that indicates to us that it is not a user-specified option,
// If the option doesn't have a data points value, that indicates to us that it is not a user-specified option,
// but represents the "Not Selected" option which all criterion drop-downs have.
// but represents the "Not Selected" option which all criterion drop-downs have.
if
(
typeof
points
===
'undefined'
)
{
var
finalLabel
=
""
;
$
(
element
).
text
(
if
(
points
===
undefined
)
{
gettext
(
'Not Selected'
)
finalLabel
=
gettext
(
'Not Selected'
);
);
}
// If the points are invalid, we'll be given NaN
// Don't show this to the user.
else
if
(
isNaN
(
points
))
{
finalLabel
=
label
;
}
}
// Otherwise, set the text of the option element to be the properly conjugated, translated string.
// Otherwise, set the text of the option element to be the properly conjugated, translated string.
else
{
else
{
$
(
element
).
text
(
finalLabel
=
ngettext
(
singularString
,
multipleString
,
points
);
ngettext
(
singularString
,
multipleString
,
points
)
);
}
}
$
(
element
).
text
(
finalLabel
);
}
}
};
};
...
...
openassessment/xblock/static/js/src/studio/oa_edit_listeners.js
View file @
1e0c3f49
...
@@ -22,6 +22,7 @@ OpenAssessment.StudentTrainingListener.prototype = {
...
@@ -22,6 +22,7 @@ OpenAssessment.StudentTrainingListener.prototype = {
optionUpdated
:
function
(
data
)
{
optionUpdated
:
function
(
data
)
{
var
view
=
this
;
var
view
=
this
;
var
sel
=
'.openassessment_training_example_criterion[data-criterion="'
+
data
.
criterionName
+
'"]'
;
var
sel
=
'.openassessment_training_example_criterion[data-criterion="'
+
data
.
criterionName
+
'"]'
;
$
(
sel
,
this
.
element
).
each
(
$
(
sel
,
this
.
element
).
each
(
function
()
{
function
()
{
var
criterion
=
this
;
var
criterion
=
this
;
...
...
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