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
d580f825
Commit
d580f825
authored
Feb 21, 2014
by
Stephen Sanchez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some tuning for peer
parent
61ab0d3a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
32 deletions
+38
-32
apps/openassessment/xblock/assessment_mixin.py
+6
-14
apps/openassessment/xblock/openassessmentblock.py
+7
-7
apps/openassessment/xblock/peer_assessment_mixin.py
+19
-5
apps/openassessment/xblock/static/js/src/oa_base.js
+5
-5
apps/openassessment/xblock/submission_mixin.py
+1
-1
No files found.
apps/openassessment/xblock/assessment_mixin.py
View file @
d580f825
...
...
@@ -5,25 +5,18 @@ from webob import Response
class
AssessmentMixin
(
object
):
def
render
(
self
,
path
):
def
render
(
self
,
path
,
context_dict
=
None
):
"""Render an Assessment Module's HTML
Given the name of an assessment module, find it in the list of
configured modules, and ask for its rendered HTML.
"""
context_dict
=
{
"xblock_trace"
:
self
.
_get_xblock_trace
(),
"rubric_instructions"
:
self
.
rubric_instructions
,
"rubric_criteria"
:
self
.
rubric_criteria
,
}
if
not
context_dict
:
context_dict
=
{}
context_dict
[
"xblock_trace"
]
=
self
.
get_xblock_trace
()
context_dict
[
"rubric_instructions"
]
=
self
.
rubric_instructions
context_dict
[
"rubric_criteria"
]
=
self
.
rubric_criteria
template
=
get_template
(
path
)
context
=
Context
(
context_dict
)
return
Response
(
template
.
render
(
context
),
content_type
=
'application/html'
,
charset
=
'UTF-8'
)
def
_get_assessment_module
(
self
,
mixin_name
):
"""Get a configured assessment module by name.
"""
for
assessment
in
self
.
rubric_assessments
:
if
assessment
.
name
==
mixin_name
:
return
assessment
\ No newline at end of file
apps/openassessment/xblock/openassessmentblock.py
View file @
d580f825
...
...
@@ -179,7 +179,7 @@ class OpenAssessmentBlock(XBlock, SubmissionMixin, PeerAssessmentMixin, SelfAsse
help
=
"The course_id associated with this prompt (until we can get it from runtime)."
,
)
def
_
get_xblock_trace
(
self
):
def
get_xblock_trace
(
self
):
"""Uniquely identify this xblock by context.
Every XBlock has a scope_ids, which is a NamedTuple describing
...
...
@@ -191,12 +191,12 @@ class OpenAssessmentBlock(XBlock, SubmissionMixin, PeerAssessmentMixin, SelfAsse
Useful for logging, debugging, and uniqueification."""
return
self
.
scope_ids
.
usage_id
,
self
.
scope_ids
.
user_id
def
_
get_student_item_dict
(
self
):
def
get_student_item_dict
(
self
):
"""Create a student_item_dict from our surrounding context.
See also: submissions.api for details.
"""
item_id
,
student_id
=
self
.
_
get_xblock_trace
()
item_id
,
student_id
=
self
.
get_xblock_trace
()
student_item_dict
=
dict
(
student_id
=
student_id
,
item_id
=
item_id
,
...
...
@@ -209,10 +209,10 @@ class OpenAssessmentBlock(XBlock, SubmissionMixin, PeerAssessmentMixin, SelfAsse
"""The main view of OpenAssessmentBlock, displayed when viewing courses.
"""
trace
=
self
.
_
get_xblock_trace
()
student_item_dict
=
self
.
_
get_student_item_dict
()
trace
=
self
.
get_xblock_trace
()
student_item_dict
=
self
.
get_student_item_dict
()
grade_state
=
self
.
_
get_grade_state
()
grade_state
=
self
.
get_grade_state
()
# All data we intend to pass to the front end.
context_dict
=
{
"xblock_trace"
:
trace
,
...
...
@@ -262,7 +262,7 @@ class OpenAssessmentBlock(XBlock, SubmissionMixin, PeerAssessmentMixin, SelfAsse
block
=
sparser
.
parse
()
return
block
def
_
get_grade_state
(
self
):
def
get_grade_state
(
self
):
# TODO: Determine if we want to build out grade state right now.
grade_state
=
{
...
...
apps/openassessment/xblock/peer_assessment_mixin.py
View file @
d580f825
...
...
@@ -8,9 +8,9 @@ class PeerAssessmentMixin(AssessmentMixin):
@XBlock.json_handler
def
assess
(
self
,
data
,
suffix
=
''
):
"""Place an assessment into Open
a
ssessment system
"""Place an assessment into Open
A
ssessment system
"""
with
self
.
_
get_assessment_module
(
'peer-assessment'
)
as
assessment
:
with
self
.
get_assessment_module
(
'peer-assessment'
)
as
assessment
:
assessment_dict
=
{
"points_earned"
:
map
(
int
,
data
[
"points_earned"
]),
...
...
@@ -19,7 +19,7 @@ class PeerAssessmentMixin(AssessmentMixin):
}
assessment
=
peer_api
.
create_assessment
(
data
[
"submission_uuid"
],
self
.
_
get_student_item_dict
()[
"student_id"
],
self
.
get_student_item_dict
()[
"student_id"
],
int
(
assessment
.
must_grade
),
int
(
assessment
.
must_be_graded_by
),
assessment_dict
...
...
@@ -32,7 +32,14 @@ class PeerAssessmentMixin(AssessmentMixin):
@XBlock.handler
def
render_peer_assessment
(
self
,
data
,
suffix
=
''
):
return
super
(
PeerAssessmentMixin
,
self
)
.
render
(
'static/html/oa_peer_assessment.html'
)
with
self
.
get_assessment_module
(
'peer-assessment'
)
as
assessment
:
context_dict
=
{
"peer_submission"
:
self
.
get_peer_submission
(
self
.
get_student_item_dict
(),
assessment
)}
return
super
(
PeerAssessmentMixin
,
self
)
.
render
(
'static/html/oa_peer_assessment.html'
,
context_dict
)
def
get_peer_submission
(
self
,
student_item_dict
,
assessment
):
peer_submission
=
False
...
...
@@ -40,7 +47,6 @@ class PeerAssessmentMixin(AssessmentMixin):
peer_submission
=
peer_api
.
get_submission_to_assess
(
student_item_dict
,
assessment
.
must_be_graded_by
)
# context_dict["peer_submission"] = peer_submission
peer_submission
=
peer_api
.
get_submission_to_assess
(
student_item_dict
,
...
...
@@ -51,3 +57,10 @@ class PeerAssessmentMixin(AssessmentMixin):
# TODO: Log?
pass
return
peer_submission
def
get_assessment_module
(
self
,
mixin_name
):
"""Get a configured assessment module by name.
"""
for
assessment
in
self
.
rubric_assessments
:
if
assessment
.
name
==
mixin_name
:
return
assessment
\ No newline at end of file
apps/openassessment/xblock/static/js/src/oa_base.js
View file @
d580f825
/* START Javascript for Open
a
ssessmentXBlock. */
/* START Javascript for Open
A
ssessmentXBlock. */
function
OpenAssessmentBlock
(
runtime
,
element
)
{
var
handlerUrl
=
runtime
.
handlerUrl
(
element
,
'submit'
);
...
...
@@ -8,7 +8,7 @@ function OpenAssessmentBlock(runtime, element) {
/* Sample Debug Console: http://localhost:8000/submissions/Joe_Bloggs/TestCourse/u_3 */
/*
Submission Functions
*
Submission Functions
*/
function
render_submissions
(
data
)
{
$
(
'#submission'
,
element
).
replaceWith
(
data
);
...
...
@@ -38,8 +38,8 @@ function OpenAssessmentBlock(runtime, element) {
}
/*
Peer Assessment Functions
*/
*
Peer Assessment Functions
*/
function
render_peer_assessment
(
data
)
{
$
(
'#peer-assessment'
,
element
).
replaceWith
(
data
);
...
...
@@ -89,4 +89,4 @@ function OpenAssessmentBlock(runtime, element) {
});
});
}
/* END Javascript for Open
a
ssessmentXBlock. */
/* END Javascript for Open
A
ssessmentXBlock. */
apps/openassessment/xblock/submission_mixin.py
View file @
d580f825
...
...
@@ -18,7 +18,7 @@ class SubmissionMixin(AssessmentMixin):
"""
Place the submission text into Openassessment system
"""
student_item_dict
=
self
.
_
get_student_item_dict
()
student_item_dict
=
self
.
get_student_item_dict
()
status
=
False
status_text
=
None
student_sub
=
data
[
'submission'
]
...
...
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