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
38f5f508
Commit
38f5f508
authored
Jan 30, 2014
by
Joe Blaylock
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19 from edx/jrbl/working_submissions
Wiring up submissions
parents
1c9b9fe0
3a3ae8cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
9 deletions
+32
-9
apps/openassessment/xblock/openassessmentblock.py
+12
-9
apps/submissions/tests/test_api.py
+20
-0
No files found.
apps/openassessment/xblock/openassessmentblock.py
View file @
38f5f508
...
@@ -4,6 +4,8 @@ import pkg_resources
...
@@ -4,6 +4,8 @@ import pkg_resources
from
mako.template
import
Template
from
mako.template
import
Template
from
submissions
import
api
from
xblock.core
import
XBlock
from
xblock.core
import
XBlock
from
xblock.fields
import
Scope
,
String
from
xblock.fields
import
Scope
,
String
from
xblock.fragment
import
Fragment
from
xblock.fragment
import
Fragment
...
@@ -52,12 +54,6 @@ class OpenAssessmentBlock(XBlock):
...
@@ -52,12 +54,6 @@ class OpenAssessmentBlock(XBlock):
)
)
frag
=
Fragment
(
html
.
render_unicode
(
xblock_trace
=
trace
,
question
=
self
.
question
))
frag
=
Fragment
(
html
.
render_unicode
(
xblock_trace
=
trace
,
question
=
self
.
question
))
frag
.
add_css
(
load
(
"static/css/openassessment_compose.css"
))
frag
.
add_css
(
load
(
"static/css/openassessment_compose.css"
))
# XXX: I'm sure there's a more socially acceptable way to get our values
# into the js. But once we've invoked mako it's so tempting....
#frag.add_javascript(Template(load("static/js/src/openassessment_compose.js"),
# default_filters=mako_default_filters,
# output_encoding='utf-8'
# ).render(xblock_trace=trace))
frag
.
add_javascript
(
load
(
"static/js/src/openassessment_compose.js"
))
frag
.
add_javascript
(
load
(
"static/js/src/openassessment_compose.js"
))
frag
.
initialize_js
(
'OpenassessmentComposeXBlock'
)
frag
.
initialize_js
(
'OpenassessmentComposeXBlock'
)
return
frag
return
frag
...
@@ -67,10 +63,17 @@ class OpenAssessmentBlock(XBlock):
...
@@ -67,10 +63,17 @@ class OpenAssessmentBlock(XBlock):
"""
"""
Place the submission text into Openassessment system
Place the submission text into Openassessment system
"""
"""
# FIXME: Do something
student_sub
=
data
[
'submission'
]
student_sub
=
data
[
'submission'
]
self
.
student_sub
=
student_sub
item_id
,
student_id
=
self
.
_get_xblock_trace
()
return
'{"sub": "
%
s"}'
%
student_sub
student_item_dict
=
dict
(
student_id
=
student_id
,
item_id
=
item_id
,
# XXX: The XBlock API doesn't make course_id's available
course_id
=
'TestCourse'
,
item_type
=
'peer'
# XXX: FIXME this is the only implementation so far
)
response
=
api
.
create_submission
(
student_item_dict
,
student_sub
)
return
'{"sub": "
%
s"}'
%
response
# TO-DO: change this to create the scenarios you'd like to see in the
# TO-DO: change this to create the scenarios you'd like to see in the
# workbench while developing your XBlock.
# workbench while developing your XBlock.
...
...
apps/submissions/tests/test_api.py
View file @
38f5f508
...
@@ -17,6 +17,13 @@ STUDENT_ITEM = dict(
...
@@ -17,6 +17,13 @@ STUDENT_ITEM = dict(
item_type
=
"Peer_Submission"
,
item_type
=
"Peer_Submission"
,
)
)
SECOND_STUDENT_ITEM
=
dict
(
student_id
=
"Bob"
,
course_id
=
"Demo_Course"
,
item_id
=
"item_one"
,
item_type
=
"Peer_Submission"
,
)
ANSWER_ONE
=
u"this is my answer!"
ANSWER_ONE
=
u"this is my answer!"
ANSWER_TWO
=
u"this is my other answer!"
ANSWER_TWO
=
u"this is my other answer!"
...
@@ -35,6 +42,19 @@ class TestApi(TestCase):
...
@@ -35,6 +42,19 @@ class TestApi(TestCase):
self
.
_assert_submission
(
submissions
[
1
],
ANSWER_ONE
,
1
,
1
)
self
.
_assert_submission
(
submissions
[
1
],
ANSWER_ONE
,
1
,
1
)
self
.
_assert_submission
(
submissions
[
0
],
ANSWER_TWO
,
1
,
2
)
self
.
_assert_submission
(
submissions
[
0
],
ANSWER_TWO
,
1
,
2
)
def
test_two_students
(
self
):
create_submission
(
STUDENT_ITEM
,
ANSWER_ONE
)
create_submission
(
SECOND_STUDENT_ITEM
,
ANSWER_TWO
)
submissions
=
get_submissions
(
STUDENT_ITEM
)
self
.
assertEqual
(
1
,
len
(
submissions
))
self
.
_assert_submission
(
submissions
[
0
],
ANSWER_ONE
,
1
,
1
)
submissions
=
get_submissions
(
SECOND_STUDENT_ITEM
)
self
.
assertEqual
(
1
,
len
(
submissions
))
self
.
_assert_submission
(
submissions
[
0
],
ANSWER_TWO
,
2
,
1
)
@file_data
(
'test_valid_student_items.json'
)
@file_data
(
'test_valid_student_items.json'
)
def
test_various_student_items
(
self
,
valid_student_item
):
def
test_various_student_items
(
self
,
valid_student_item
):
create_submission
(
valid_student_item
,
ANSWER_ONE
)
create_submission
(
valid_student_item
,
ANSWER_ONE
)
...
...
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