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
a886d1b3
Commit
a886d1b3
authored
Aug 06, 2014
by
gradyward
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #581 from edx/grady/ORA-767
Fixes ORA 767
parents
dab8db7a
e4afa2d4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
169 additions
and
28 deletions
+169
-28
openassessment/templates/openassessmentblock/edit/oa_training_example_criterion.html
+1
-1
openassessment/xblock/static/js/openassessment-lms.min.js
+0
-0
openassessment/xblock/static/js/openassessment-studio.min.js
+0
-0
openassessment/xblock/static/js/spec/studio/oa_edit_listeners.js
+142
-9
openassessment/xblock/static/js/src/studio/oa_container_item.js
+13
-13
openassessment/xblock/static/js/src/studio/oa_edit_assessment.js
+8
-0
openassessment/xblock/static/js/src/studio/oa_edit_listeners.js
+4
-4
requirements/base.txt
+1
-1
No files found.
openassessment/templates/openassessmentblock/edit/oa_training_example_criterion.html
View file @
a886d1b3
...
...
@@ -7,7 +7,7 @@
{{ criterion.label }}
</div>
<select
class=
"openassessment_training_example_criterion_option setting-input"
data-criterion=
"{{ criterion.name }}"
data-option=
"{{ option.name }}"
>
<option
value=
""
>
{% trans "Not S
cor
ed" %}
</option>
<option
value=
""
>
{% trans "Not S
elect
ed" %}
</option>
{% for option in criterion.options %}
<option
value=
"{{ option.name }}"
data-points=
"{{ option.points }}"
data-label=
"{{ option.label }}"
{%
if
criterion
.
option_selected =
=
option
.
name
%}
selected
{%
endif
%}
...
...
openassessment/xblock/static/js/openassessment-lms.min.js
View file @
a886d1b3
This diff is collapsed.
Click to expand it.
openassessment/xblock/static/js/openassessment-studio.min.js
View file @
a886d1b3
This diff is collapsed.
Click to expand it.
openassessment/xblock/static/js/spec/studio/oa_edit_listeners.js
View file @
a886d1b3
...
...
@@ -51,7 +51,7 @@ describe("OpenAssessment.StudentTrainingListener", function() {
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not S
cor
ed"
,
""
:
"Not S
elect
ed"
,
option_1
:
"Fair - 1 points"
,
option_2
:
"Good - 2 points"
}
...
...
@@ -71,7 +71,7 @@ describe("OpenAssessment.StudentTrainingListener", function() {
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not S
cor
ed"
,
""
:
"Not S
elect
ed"
,
option_1
:
"This is a new label! - 42 points"
,
option_2
:
"Good - 2 points"
}
...
...
@@ -93,7 +93,7 @@ describe("OpenAssessment.StudentTrainingListener", function() {
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not S
cor
ed"
,
""
:
"Not S
elect
ed"
,
option_1
:
"This is a new label!"
,
option_2
:
"Good - 2 points"
}
...
...
@@ -108,7 +108,7 @@ describe("OpenAssessment.StudentTrainingListener", function() {
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not S
cor
ed"
,
""
:
"Not S
elect
ed"
,
option_1
:
"Fair - 1 points"
,
option_2
:
"Good - 2 points"
}
...
...
@@ -127,7 +127,7 @@ describe("OpenAssessment.StudentTrainingListener", function() {
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not S
cor
ed"
,
""
:
"Not S
elect
ed"
,
option_2
:
"Good - 2 points"
}
}
...
...
@@ -219,12 +219,12 @@ describe("OpenAssessment.StudentTrainingListener", function() {
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not S
cor
ed"
,
""
:
"Not S
elect
ed"
,
option_1
:
"Fair - 1 points"
,
option_2
:
"Good - 2 points"
,
},
new_criterion
:
{
""
:
"Not S
cor
ed"
,
""
:
"Not S
elect
ed"
,
new_option
:
"This is a new option! - 56 points"
}
}
...
...
@@ -241,12 +241,12 @@ describe("OpenAssessment.StudentTrainingListener", function() {
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not S
cor
ed"
,
""
:
"Not S
elect
ed"
,
option_1
:
"Fair - 1 points"
,
option_2
:
"Good - 2 points"
,
},
new_criterion
:
{
""
:
"Not S
cor
ed"
,
""
:
"Not S
elect
ed"
,
new_option
:
"This is a new option! - 56 points"
,
yet_another_option
:
"This is yet another option! - 27 points"
}
...
...
@@ -341,3 +341,135 @@ describe("OpenAssessment.AssessmentToggleListener", function() {
expect
(
alert
.
isVisible
()).
toBe
(
false
);
});
});
describe
(
"OpenAssessment.StudentTrainingListenerWithTrainingExamples"
,
function
()
{
var
listener
=
null
;
var
view
=
null
;
/**
Check that all student training examples have the expected
criteria or option labels.
Args:
actual (array): A list of example criteria or option labels
(object literals) retrieved from the DOM.
expected (object literal): The expected value for each example.
numExamples (int, optional): The number of student training examples
(defaults to 1).
**/
var
assertExampleLabels
=
function
(
actual
,
expected
,
numExamples
)
{
// The most common case is one example, so use that as a default.
if
(
typeof
(
numExamples
)
==
"undefined"
)
{
numExamples
=
1
;
}
// Add one to the number of examples to include the client-side template.
expect
(
actual
.
length
).
toEqual
(
numExamples
+
1
);
// Verify that each example matches what we expect.
// Since there is only one rubric for the problem,
// the training examples should always match that rubric.
for
(
var
index
in
actual
)
{
for
(
var
criterionName
in
expected
)
{
expect
(
actual
[
index
][
criterionName
]).
toEqual
(
expected
[
criterionName
]);
}
}
};
beforeEach
(
function
()
{
loadFixtures
(
'oa_edit_student_training.html'
);
listener
=
new
OpenAssessment
.
StudentTrainingListener
();
view
=
new
OpenAssessment
.
EditStudentTrainingView
(
'#oa_student_training_editor'
);
});
it
(
"adds a criterion and an option, then adds a training example"
,
function
(){
// Initial state, set by the fixture
assertExampleLabels
(
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not Selected"
,
option_1
:
"Fair - 1 points"
,
option_2
:
"Good - 2 points"
}
}
);
// Sets the option number to a number greater than one to prevent case conflicts
// (which are reliant on pieces of code not being tested here)
listener
.
optionUpdated
({
criterionName
:
'criterion_with_two_options'
,
name
:
'option_1'
,
label
:
'Fair'
,
points
:
'2'
});
assertExampleLabels
(
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not Selected"
,
option_1
:
"Fair - 2 points"
,
option_2
:
"Good - 2 points"
}
}
);
// Adds a criterion
listener
.
criterionAdd
({
criterionName
:
"new_criterion"
,
label
:
"This is a new criterion!"
});
// Add an option to the criterion
listener
.
optionAdd
({
criterionName
:
"new_criterion"
,
name
:
"new_option"
,
label
:
"This is a new option!"
,
points
:
56
});
assertExampleLabels
(
listener
.
examplesOptionsLabels
(),
{
criterion_with_two_options
:
{
""
:
"Not Selected"
,
option_1
:
"Fair - 2 points"
,
option_2
:
"Good - 2 points"
,
},
new_criterion
:
{
""
:
"Not Selected"
,
new_option
:
"This is a new option! - 56 points"
}
}
);
// Adds a student training example
view
.
addTrainingExample
();
var
options
=
listener
.
examplesOptionsLabels
();
// Asserts that the example labels are the same for the student training example
// and in doing so, checks that all changes were made to the studnet training template.
assertExampleLabels
(
options
,
{
criterion_with_two_options
:
{
""
:
"Not Selected"
,
option_1
:
"Fair - 2 points"
,
option_2
:
"Good - 2 points"
,
},
new_criterion
:
{
""
:
"Not Selected"
,
new_option
:
"This is a new option! - 56 points"
}
},
2
);
});
});
\ No newline at end of file
openassessment/xblock/static/js/src/studio/oa_container_item.js
View file @
a886d1b3
...
...
@@ -33,6 +33,7 @@ OpenAssessment.ItemUtilities = {
refreshOptionString
:
function
(
element
)
{
var
points
=
$
(
element
).
data
(
'points'
);
var
label
=
$
(
element
).
data
(
'label'
);
var
name
=
$
(
element
).
val
();
// We don't want the lack of a label to make it look like - 1 points.
if
(
label
===
""
){
label
=
gettext
(
'Unnamed Option'
);
...
...
@@ -40,10 +41,11 @@ OpenAssessment.ItemUtilities = {
var
singularString
=
label
+
" - "
+
points
+
" point"
;
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,
// but represents the "Not Selected" option which all criterion drop-downs have.
// If the option's name value is the empty string, that indicates to us that it is not a user-specified option,
// but represents the "Not Selected" option which all criterion drop-downs have. This is an acceptable
// assumption because we require name (option value) to be a unique identifier for each option.
var
finalLabel
=
""
;
if
(
points
===
undefined
)
{
if
(
name
===
''
)
{
finalLabel
=
gettext
(
'Not Selected'
);
}
...
...
@@ -486,15 +488,6 @@ OpenAssessment.TrainingExample = function(element){
this
.
element
=
element
;
this
.
criteria
=
$
(
".openassessment_training_example_criterion_option"
,
this
.
element
);
this
.
answer
=
$
(
'.openassessment_training_example_essay'
,
this
.
element
).
first
();
// Initialize the option label in the training example for each option.
this
.
criteria
.
each
(
function
()
{
$
(
'option'
,
this
).
each
(
function
(){
OpenAssessment
.
ItemUtilities
.
refreshOptionString
(
$
(
this
));
});
}
);
};
OpenAssessment
.
TrainingExample
.
prototype
=
{
...
...
@@ -520,7 +513,14 @@ OpenAssessment.TrainingExample.prototype = {
};
},
addHandler
:
function
()
{},
addHandler
:
function
()
{
// Goes through and instantiates the option description in the training example for each option.
$
(
".openassessment_training_example_criterion_option"
,
this
.
element
)
.
each
(
function
()
{
$
(
'option'
,
this
).
each
(
function
(){
OpenAssessment
.
ItemUtilities
.
refreshOptionString
(
$
(
this
));
});
});
},
addEventListeners
:
function
()
{},
removeHandler
:
function
()
{},
updateHandler
:
function
()
{},
...
...
openassessment/xblock/static/js/src/studio/oa_edit_assessment.js
View file @
a886d1b3
...
...
@@ -516,6 +516,14 @@ OpenAssessment.EditStudentTrainingView.prototype = {
this
.
clearValidationErrors
();
});
},
/**
Adds a new training example by copying the training example template.
Primarily used for testing.
**/
addTrainingExample
:
function
()
{
this
.
exampleContainer
.
add
();
}
};
/**
...
...
openassessment/xblock/static/js/src/studio/oa_edit_listeners.js
View file @
a886d1b3
...
...
@@ -24,8 +24,8 @@ OpenAssessment.StudentTrainingListener.prototype = {
function
()
{
var
criterion
=
this
;
var
option
=
$
(
'option[value="'
+
data
.
name
+
'"]'
,
criterion
)
.
data
(
"
points"
,
data
.
points
)
.
data
(
"
label"
,
data
.
label
);
.
attr
(
"data-
points"
,
data
.
points
)
.
attr
(
"data-
label"
,
data
.
label
);
OpenAssessment
.
ItemUtilities
.
refreshOptionString
(
option
);
}
);
...
...
@@ -62,8 +62,8 @@ OpenAssessment.StudentTrainingListener.prototype = {
// but this avoids overly complex templating code.
var
option
=
$
(
"<option></option>"
)
.
attr
(
"value"
,
data
.
name
)
.
data
(
"
points"
,
data
.
points
)
.
data
(
"
label"
,
data
.
label
);
.
attr
(
"data-
points"
,
data
.
points
)
.
attr
(
"data-
label"
,
data
.
label
);
// Sets the option's text description, and adds it to the criterion.
OpenAssessment
.
ItemUtilities
.
refreshOptionString
(
option
);
...
...
requirements/base.txt
View file @
a886d1b3
...
...
@@ -9,7 +9,7 @@ git+https://github.com/edx/xblock-sdk.git@643900aadcb18aaeb7fe67271ca9dbf36e463e
edx-submissions==0.0.6
# Third Party Requirements
boto>=2.
13
.0,<3.0.0
boto>=2.
30
.0,<3.0.0
celery==3.0.19
defusedxml==0.4.1
dogapi==1.2.1
...
...
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