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
1f71b148
Commit
1f71b148
authored
May 29, 2014
by
Stephen Sanchez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing a race condition loading sections of the ORA2 UI
parent
860b28fd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
0 deletions
+32
-0
apps/openassessment/xblock/static/js/openassessment.min.js
+0
-0
apps/openassessment/xblock/static/js/src/oa_training.js
+1
-0
apps/openassessment/xblock/student_training_mixin.py
+7
-0
apps/openassessment/xblock/test/test_student_training.py
+24
-0
No files found.
apps/openassessment/xblock/static/js/openassessment.min.js
View file @
1f71b148
This diff is collapsed.
Click to expand it.
apps/openassessment/xblock/static/js/src/oa_training.js
View file @
1f71b148
...
...
@@ -88,6 +88,7 @@ OpenAssessment.StudentTrainingView.prototype = {
var
instructions
=
$
(
"#openassessment__student-training--instructions"
,
this
.
element
);
if
(
!
view
.
rubric
.
showCorrections
(
corrections
))
{
view
.
load
();
baseView
.
loadAssessmentModules
();
incorrect
.
addClass
(
"is--hidden"
);
instructions
.
removeClass
(
"is--hidden"
);
...
...
apps/openassessment/xblock/student_training_mixin.py
View file @
1f71b148
...
...
@@ -6,6 +6,7 @@ from django.utils.translation import ugettext as _
from
webob
import
Response
from
xblock.core
import
XBlock
from
openassessment.assessment.api
import
student_training
import
openassessment.workflow.api
as
workflow_api
from
openassessment.xblock.data_conversion
import
convert_training_examples_list_to_dict
from
.resolve_dates
import
DISTANT_FUTURE
...
...
@@ -169,6 +170,12 @@ class StudentTrainingMixin(object):
'msg'
:
_
(
u"An unexpected error occurred."
)
}
else
:
try
:
self
.
update_workflow_status
()
except
workflow_api
.
AssessmentWorkflowError
:
msg
=
_
(
'Could not update workflow status.'
)
logger
.
exception
(
msg
)
return
{
'success'
:
False
,
'msg'
:
msg
}
return
{
'success'
:
True
,
'msg'
:
u''
,
...
...
apps/openassessment/xblock/test/test_student_training.py
View file @
1f71b148
...
...
@@ -9,6 +9,7 @@ from mock import patch
import
pytz
from
django.db
import
DatabaseError
from
openassessment.assessment.models
import
StudentTrainingWorkflow
from
openassessment.workflow
import
api
as
workflow_api
from
.base
import
XBlockHandlerTestCase
,
scenario
@ddt.ddt
...
...
@@ -42,6 +43,29 @@ class StudentTrainingAssessTest(XBlockHandlerTestCase):
@scenario
(
'data/student_training.xml'
,
user_id
=
"Plato"
)
@ddt.file_data
(
'data/student_training_mixin.json'
)
def
test_correct_with_error
(
self
,
xblock
,
data
):
xblock
.
create_submission
(
xblock
.
get_student_item_dict
(),
self
.
SUBMISSION
)
self
.
_assert_path_and_context
(
xblock
,
data
[
"expected_template"
],
data
[
"expected_context"
])
# Agree with the course author's assessment
# (as defined in the scenario XML)
data
=
{
'options_selected'
:
{
'Vocabulary'
:
'Good'
,
'Grammar'
:
'Excellent'
}
}
with
patch
.
object
(
workflow_api
,
"update_from_assessments"
)
as
mock_workflow_update
:
mock_workflow_update
.
side_effect
=
workflow_api
.
AssessmentWorkflowError
(
"Oh no!"
)
resp
=
self
.
request
(
xblock
,
'training_assess'
,
json
.
dumps
(
data
),
response_format
=
'json'
)
# Expect that we were not correct due to a workflow update error.
self
.
assertFalse
(
resp
[
'success'
],
msg
=
resp
.
get
(
'msg'
))
self
.
assertEquals
(
'Could not update workflow status.'
,
resp
.
get
(
'msg'
))
self
.
assertFalse
(
'corrections'
in
resp
)
@scenario
(
'data/student_training.xml'
,
user_id
=
"Plato"
)
@ddt.file_data
(
'data/student_training_mixin.json'
)
def
test_incorrect
(
self
,
xblock
,
data
):
xblock
.
create_submission
(
xblock
.
get_student_item_dict
(),
self
.
SUBMISSION
)
self
.
_assert_path_and_context
(
xblock
,
data
[
"expected_template"
],
data
[
"expected_context"
])
...
...
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