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
a3ba60ea
Commit
a3ba60ea
authored
Feb 21, 2014
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #41 from edx/jrbl/125-show-users-scored-subs
TIM-125: Pull request fixups
parents
5f6071b8
4ce087e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
25 deletions
+26
-25
apps/openassessment/xblock/openassessmentblock.py
+23
-25
apps/openassessment/xblock/static/html/oa_rubric.html
+3
-0
No files found.
apps/openassessment/xblock/openassessmentblock.py
View file @
a3ba60ea
...
...
@@ -279,29 +279,26 @@ class OpenAssessmentBlock(XBlock):
trace
=
self
.
_get_xblock_trace
()
student_item_dict
=
self
.
_get_student_item_dict
()
# This user's most recent previous submission
user_submission
=
self
.
_
_get
_submission
(
student_item_dict
)
user_submission
=
self
.
_
get_user
_submission
(
student_item_dict
)
# This score for this user's user_submission
user_score
=
self
.
_
_get
_score
(
student_item_dict
,
user_submission
)
user_score
=
self
.
_
get_submission
_score
(
student_item_dict
,
user_submission
)
peer_eval
=
self
.
_hack_get_eval
()
# HACK: Replace with proper workflow.
peer_submission
=
self
.
_
_
get_peer_submission
(
student_item_dict
,
peer_eval
)
peer_submission
=
self
.
_get_peer_submission
(
student_item_dict
,
peer_eval
)
if
user_score
:
# We're Done!
return
self
.
__view_helper_show_scores
(
user_score
,
trace
)
elif
user_submission
and
peer_submission
:
if
user_submission
and
peer_submission
:
# We've submitted, but not finished assessing. Do assessments.
return
self
.
_view_helper_make_assessment
(
peer_submission
,
trace
)
return
self
.
show_assessment_html
(
peer_submission
,
trace
)
elif
user_submission
:
# We've submitted, but there's no assesing to do yet.
return
self
.
__view_helper_check_back
(
)
return
self
.
show_check_back_html
(
user_score
)
else
:
# We haven't submitted, so do that first.
# XXX: In future, we'll support multiple submission and this will be wrong
return
self
.
_view_helper_make_submission
(
trace
)
return
self
.
show_submission_html
(
trace
)
@staticmethod
def
_
_get
_submission
(
student_item_dict
):
def
_
get_user
_submission
(
student_item_dict
):
"""Return the most recent submission, if any, by user in student_item_dict"""
submissions
=
[]
try
:
...
...
@@ -312,7 +309,7 @@ class OpenAssessmentBlock(XBlock):
return
submissions
[
0
]
if
submissions
else
None
@staticmethod
def
_
_get
_score
(
student_item_dict
,
submission
=
False
):
def
_
get_submission
_score
(
student_item_dict
,
submission
=
False
):
"""Return the most recent score, if any, for student item"""
scores
=
False
if
submission
:
...
...
@@ -320,7 +317,7 @@ class OpenAssessmentBlock(XBlock):
return
scores
[
0
]
if
scores
else
None
@staticmethod
def
_
_
get_peer_submission
(
student_item_dict
,
peer_eval
):
def
_get_peer_submission
(
student_item_dict
,
peer_eval
):
"""Return a peer submission, if any, for user to assess"""
peer_submission
=
None
try
:
...
...
@@ -332,18 +329,17 @@ class OpenAssessmentBlock(XBlock):
pass
return
peer_submission
def
__view_helper_show_check_back
(
self
):
def
show_check_back_html
(
self
,
user_score
=
None
):
"""Return HTML saying no peer work to assess, check back later."""
# This looks awful on purpose; XXX: should fix as shiny lands
return
Fragment
(
u"<div>There are no submissions to review. Check back soon.</div>"
)
def
__view_helper_show_scores
(
self
,
user_score
,
trace
=
None
):
"""Return HTML to display users's score to them."""
# This looks awful on purpose; XXX: should fix as shiny lands
return
Fragment
(
u"<div>You've received the following score:"
"
%
s/
%
s.</div>"
%
(
user_score
[
'points_earned'
],
user_score
[
'points_possible'
]))
html
=
""
if
user_score
:
html
=
u"<div>You've received the following score:
%
s/
%
s.</div"
%
(
user_score
[
'points_earned'
],
user_score
[
'points_possible'
])
html
+=
u"<div>There are no submissions to review. Check back soon.</div>"
return
Fragment
(
html
)
def
_view_helper_make_assessment
(
self
,
peer_submission
,
trace
=
None
):
def
show_assessment_html
(
self
,
peer_submission
,
user_score
=
None
,
trace
=
None
):
"""Return HTML for rubric display and assessment solicitation."""
# Submits to assess handler
load
=
self
.
_load
...
...
@@ -351,17 +347,19 @@ class OpenAssessmentBlock(XBlock):
default_filters
=
mako_default_filters
,
input_encoding
=
'utf-8'
,
)
frag
=
Fragment
(
html
.
render_unicode
(
xblock_trace
=
trace
,
frag
=
Fragment
(
html
.
render_unicode
(
xblock_trace
=
trace
,
peer_submission
=
peer_submission
,
rubric_instructions
=
self
.
rubric_instructions
,
rubric_criteria
=
self
.
rubric_criteria
,
user_score
=
user_score
))
frag
.
add_css
(
load
(
"static/css/openassessment.css"
))
frag
.
add_javascript
(
load
(
"static/js/src/oa_assessment.js"
))
frag
.
initialize_js
(
'OpenAssessmentBlock'
)
return
frag
def
_view_helper_make_submission
(
self
,
trace
=
None
):
def
show_submission_html
(
self
,
trace
=
None
):
"""Return HTML for the page prompting the user and soliciting submissions."""
# Submits to submission handler
load
=
self
.
_load
...
...
@@ -423,7 +421,7 @@ class OpenAssessmentBlock(XBlock):
status_text
=
None
student_sub
=
data
[
'submission'
]
student_item_dict
=
self
.
_get_student_item_dict
()
prev_sub
=
self
.
_
_get
_submission
(
student_item_dict
)
prev_sub
=
self
.
_
get_user
_submission
(
student_item_dict
)
if
prev_sub
:
# It is an error to submit multiple times for the same item
...
...
apps/openassessment/xblock/static/html/oa_rubric.html
View file @
a3ba60ea
<!-- START OpenAssessmentBlock HTML -->
% if user_score:
<div>
You've received the following score: ${user_score['points_earned']}/${user_score['points_possible']}.
</div>
% endif
<div
class=
"openassessment_block"
id=
"openassessment_block_${xblock_trace[0]}"
>
<div
id=
"peer_submission_uuid"
hidden=
"true"
>
${peer_submission["uuid"]}
</div>
<p>
${peer_submission["answer"]}
</p>
...
...
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