Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
9d4119b2
Commit
9d4119b2
authored
Jan 15, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1278 from MITx/vik/modify-rubric-input
Vik/modify rubric input
parents
79c8efcb
be3d8cbb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
14 deletions
+63
-14
common/lib/xmodule/xmodule/combined_open_ended_module.py
+8
-0
common/lib/xmodule/xmodule/combined_open_ended_rubric.py
+13
-3
common/lib/xmodule/xmodule/open_ended_module.py
+1
-1
common/lib/xmodule/xmodule/self_assessment_module.py
+1
-1
lms/djangoapps/open_ended_grading/staff_grading_service.py
+10
-4
lms/static/coffee/src/staff_grading/staff_grading.coffee
+28
-5
lms/templates/instructor/staff_grading.html
+2
-0
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
9d4119b2
...
...
@@ -21,6 +21,8 @@ from .xml_module import XmlDescriptor
from
xmodule.modulestore
import
Location
import
self_assessment_module
import
open_ended_module
from
combined_open_ended_rubric
import
CombinedOpenEndedRubric
from
.stringify
import
stringify_children
from
mitxmako.shortcuts
import
render_to_string
...
...
@@ -140,6 +142,12 @@ class CombinedOpenEndedModule(XModule):
# completion (doesn't matter if you self-assessed correct/incorrect).
self
.
_max_score
=
int
(
self
.
metadata
.
get
(
'max_score'
,
MAX_SCORE
))
rubric_renderer
=
CombinedOpenEndedRubric
(
True
)
success
,
rubric_feedback
=
rubric_renderer
.
render_rubric
(
stringify_children
(
definition
[
'rubric'
]))
if
not
success
:
error_message
=
"Could not parse rubric : {0}"
.
format
(
definition
[
'rubric'
])
log
.
exception
(
error_message
)
raise
Exception
#Static data is passed to the child modules to render
self
.
static_data
=
{
'max_score'
:
self
.
_max_score
,
...
...
common/lib/xmodule/xmodule/combined_open_ended_rubric.py
View file @
9d4119b2
...
...
@@ -20,16 +20,25 @@ class CombinedOpenEndedRubric:
html: the html that corresponds to the xml given
'''
def
render_rubric
(
self
,
rubric_xml
):
success
=
False
try
:
rubric_categories
=
self
.
extract_categories
(
rubric_xml
)
html
=
render_to_string
(
'open_ended_rubric.html'
,
{
'categories'
:
rubric_categories
,
'has_score'
:
self
.
has_score
,
'view_only'
:
self
.
view_only
})
success
=
True
except
:
log
.
exception
(
"Could not parse the rubric."
)
html
=
etree
.
tostring
(
rubric_xml
,
pretty_print
=
True
)
return
html
try
:
html
=
etree
.
tostring
(
rubric_xml
,
pretty_print
=
True
)
except
:
log
.
exception
(
"Rubric XML is a string, not an XML object : {0}"
.
format
(
rubric_xml
))
if
isinstance
(
rubric_xml
,
basestring
):
html
=
rubric_xml
else
:
html
=
"Invalid rubric. Please contact course staff."
return
success
,
html
def
extract_categories
(
self
,
element
):
'''
...
...
@@ -43,7 +52,8 @@ class CombinedOpenEndedRubric:
{text: "Option 3 Name", points: 2]}]
'''
element
=
etree
.
fromstring
(
element
)
if
isinstance
(
element
,
basestring
):
element
=
etree
.
fromstring
(
element
)
categories
=
[]
for
category
in
element
:
if
category
.
tag
!=
'category'
:
...
...
common/lib/xmodule/xmodule/open_ended_module.py
View file @
9d4119b2
...
...
@@ -383,7 +383,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
feedback
=
self
.
_convert_longform_feedback_to_html
(
response_items
)
if
response_items
[
'rubric_scores_complete'
]
==
True
:
rubric_renderer
=
CombinedOpenEndedRubric
(
True
)
rubric_feedback
=
rubric_renderer
.
render_rubric
(
response_items
[
'rubric_xml'
])
success
,
rubric_feedback
=
rubric_renderer
.
render_rubric
(
response_items
[
'rubric_xml'
])
if
not
response_items
[
'success'
]:
return
system
.
render_template
(
"open_ended_error.html"
,
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
9d4119b2
...
...
@@ -124,7 +124,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
rubric_renderer
=
CombinedOpenEndedRubric
(
True
)
rubric_html
=
rubric_renderer
.
render_rubric
(
self
.
rubric
)
success
,
rubric_html
=
rubric_renderer
.
render_rubric
(
self
.
rubric
)
# we'll render it
context
=
{
'rubric'
:
rubric_html
,
...
...
lms/djangoapps/open_ended_grading/staff_grading_service.py
View file @
9d4119b2
...
...
@@ -262,10 +262,16 @@ def _get_next(course_id, grader_id, location):
try
:
response
=
staff_grading_service
()
.
get_next
(
course_id
,
location
,
grader_id
)
response_json
=
json
.
loads
(
response
)
rubric
=
response_json
[
'rubric'
]
rubric_renderer
=
CombinedOpenEndedRubric
(
False
)
rubric_html
=
rubric_renderer
.
render_rubric
(
rubric
)
response_json
[
'rubric'
]
=
rubric_html
if
response_json
.
has_key
(
'rubric'
):
rubric
=
response_json
[
'rubric'
]
rubric_renderer
=
CombinedOpenEndedRubric
(
False
)
success
,
rubric_html
=
rubric_renderer
.
render_rubric
(
rubric
)
if
not
success
:
error_message
=
"Could not render rubric: {0}"
.
format
(
rubric
)
log
.
exception
(
error_message
)
return
json
.
dumps
({
'success'
:
False
,
'error'
:
error_message
})
response_json
[
'rubric'
]
=
rubric_html
return
json
.
dumps
(
response_json
)
except
GradingServiceError
:
log
.
exception
(
"Error from grading service. server url: {0}"
...
...
lms/static/coffee/src/staff_grading/staff_grading.coffee
View file @
9d4119b2
...
...
@@ -174,7 +174,8 @@ class StaffGrading
@
grading_wrapper
=
$
(
'.grading-wrapper'
)
@
feedback_area
=
$
(
'.feedback-area'
)
@
score_selection_container
=
$
(
'.score-selection-container'
)
@
score_selection_container
=
$
(
'.score-selection-container'
)
@
grade_selection_container
=
$
(
'.grade-selection-container'
)
@
submit_button
=
$
(
'.submit-button'
)
@
action_button
=
$
(
'.action-button'
)
...
...
@@ -202,6 +203,7 @@ class StaffGrading
@
num_graded
=
0
@
num_pending
=
0
@
score_lst
=
[]
@
grade
=
null
@
problems
=
null
...
...
@@ -216,10 +218,29 @@ class StaffGrading
setup_score_selection
:
=>
# first, get rid of all the old inputs, if any.
@
grade_selection_container
.
html
(
"""
<h3>Overall Score</h3>
<p>Choose an overall score for this submission.</p>
"""
)
# Now create new labels and inputs for each possible score.
for
score
in
[
0
..
@
max_score
]
id
=
'score-'
+
score
label
=
"""<label for="
#{
id
}
">
#{
score
}
</label>"""
input
=
"""
<input type="radio" class="grade-selection" name="grade-selection" id="
#{
id
}
" value="
#{
score
}
"/>
"""
# " fix broken parsing in emacs
@
grade_selection_container
.
append
(
input
+
label
)
$
(
'.grade-selection'
).
click
=>
@
graded_callback
()
@
score_selection_container
.
html
(
@
rubric
)
$
(
'.score-selection'
).
click
=>
@
graded_callback
()
graded_callback
:
()
=>
@
grade
=
$
(
"input[name='grade-selection']:checked"
).
val
()
if
@
grade
==
undefined
return
# check to see whether or not any categories have not been scored
num_categories
=
$
(
'table.rubric tr'
).
length
for
i
in
[
0
..(
num_categories
-
1
)]
...
...
@@ -229,8 +250,6 @@ class StaffGrading
# show button if we have scores for all categories
@
state
=
state_graded
@
submit_button
.
show
()
set_button_text
:
(
text
)
=>
@
action_button
.
attr
(
'value'
,
text
)
...
...
@@ -272,6 +291,7 @@ class StaffGrading
skip_and_get_next
:
()
=>
data
=
score
:
@
grade
rubric_scores
:
@
get_score_list
()
feedback
:
@
feedback_area
.
val
()
submission_id
:
@
submission_id
...
...
@@ -285,8 +305,8 @@ class StaffGrading
submit_and_get_next
:
()
->
data
=
score
:
@
grade
rubric_scores
:
@
get_score_list
()
score
:
0
feedback
:
@
feedback_area
.
val
()
submission_id
:
@
submission_id
location
:
@
location
...
...
@@ -303,6 +323,8 @@ class StaffGrading
@
rubric
=
response
.
rubric
@
submission_id
=
response
.
submission_id
@
feedback_area
.
val
(
''
)
@
grade
=
null
@
max_score
=
response
.
max_score
@
ml_error_info
=
response
.
ml_error_info
@
prompt_name
=
response
.
problem_name
@
num_graded
=
response
.
num_graded
...
...
@@ -322,9 +344,10 @@ class StaffGrading
@
ml_error_info
=
null
@
submission_id
=
null
@
message
=
message
@
grade
=
null
@
max_score
=
0
@
state
=
state_no_data
render_view
:
()
->
# clear the problem list and breadcrumbs
@
problem_list
.
html
(
''
)
...
...
lms/templates/instructor/staff_grading.html
View file @
9d4119b2
...
...
@@ -73,6 +73,8 @@
<div
class=
"evaluation"
>
<p
class=
"score-selection-container"
>
</p>
<p
class=
"grade-selection-container"
>
</p>
<textarea
name=
"feedback"
placeholder=
"Feedback for student (optional)"
class=
"feedback-area"
cols=
"70"
></textarea>
</div>
...
...
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