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
17c77dd1
Commit
17c77dd1
authored
Aug 08, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #392 from edx/fix/vik/answer-unknown
Simplify save_grade and pass through answer_unknown
parents
ece4ec3f
c9ddcd78
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
64 deletions
+46
-64
common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py
+19
-30
common/lib/xmodule/xmodule/peer_grading_module.py
+23
-33
common/lib/xmodule/xmodule/tests/test_peer_grading.py
+1
-0
lms/djangoapps/open_ended_grading/tests.py
+3
-1
No files found.
common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py
View file @
17c77dd1
...
...
@@ -36,21 +36,18 @@ class PeerGradingService(GradingService):
return
self
.
try_to_decode
(
response
)
def
get_next_submission
(
self
,
problem_location
,
grader_id
):
response
=
self
.
get
(
self
.
get_next_submission_url
,
{
'location'
:
problem_location
,
'grader_id'
:
grader_id
})
response
=
self
.
get
(
self
.
get_next_submission_url
,
{
'location'
:
problem_location
,
'grader_id'
:
grader_id
}
)
return
self
.
try_to_decode
(
self
.
_render_rubric
(
response
))
def
save_grade
(
self
,
location
,
grader_id
,
submission_id
,
score
,
feedback
,
submission_key
,
rubric_scores
,
submission_flagged
):
data
=
{
'grader_id'
:
grader_id
,
'submission_id'
:
submission_id
,
'score'
:
score
,
'feedback'
:
feedback
,
'submission_key'
:
submission_key
,
'location'
:
location
,
'rubric_scores'
:
rubric_scores
,
'rubric_scores_complete'
:
True
,
'submission_flagged'
:
submission_flagged
}
def
save_grade
(
self
,
**
kwargs
):
data
=
kwargs
data
.
update
({
'rubric_scores_complete'
:
True
})
return
self
.
try_to_decode
(
self
.
post
(
self
.
save_grade_url
,
data
))
def
is_student_calibrated
(
self
,
problem_location
,
grader_id
):
...
...
@@ -62,16 +59,9 @@ class PeerGradingService(GradingService):
response
=
self
.
get
(
self
.
show_calibration_essay_url
,
params
)
return
self
.
try_to_decode
(
self
.
_render_rubric
(
response
))
def
save_calibration_essay
(
self
,
problem_location
,
grader_id
,
calibration_essay_id
,
submission_key
,
score
,
feedback
,
rubric_scores
):
data
=
{
'location'
:
problem_location
,
'student_id'
:
grader_id
,
'calibration_essay_id'
:
calibration_essay_id
,
'submission_key'
:
submission_key
,
'score'
:
score
,
'feedback'
:
feedback
,
'rubric_scores[]'
:
rubric_scores
,
'rubric_scores_complete'
:
True
}
def
save_calibration_essay
(
self
,
**
kwargs
):
data
=
kwargs
data
.
update
({
'rubric_scores_complete'
:
True
})
return
self
.
try_to_decode
(
self
.
post
(
self
.
save_calibration_essay_url
,
data
))
def
get_problem_list
(
self
,
course_id
,
grader_id
):
...
...
@@ -100,16 +90,17 @@ without making actual service calls to the grading controller
class
MockPeerGradingService
(
object
):
def
get_next_submission
(
self
,
problem_location
,
grader_id
):
return
{
'success'
:
True
,
return
{
'success'
:
True
,
'submission_id'
:
1
,
'submission_key'
:
""
,
'student_response'
:
'fake student response'
,
'prompt'
:
'fake submission prompt'
,
'rubric'
:
'fake rubric'
,
'max_score'
:
4
}
'max_score'
:
4
}
def
save_grade
(
self
,
location
,
grader_id
,
submission_id
,
score
,
feedback
,
submission_key
,
rubric_scores
,
submission_flagged
):
def
save_grade
(
self
,
**
kwargs
):
return
{
'success'
:
True
}
def
is_student_calibrated
(
self
,
problem_location
,
grader_id
):
...
...
@@ -124,9 +115,7 @@ class MockPeerGradingService(object):
'rubric'
:
'fake rubric'
,
'max_score'
:
4
}
def
save_calibration_essay
(
self
,
problem_location
,
grader_id
,
calibration_essay_id
,
submission_key
,
score
,
feedback
,
rubric_scores
):
def
save_calibration_essay
(
self
,
**
kwargs
):
return
{
'success'
:
True
,
'actual_score'
:
2
}
def
get_problem_list
(
self
,
course_id
,
grader_id
):
...
...
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
17c77dd1
...
...
@@ -23,6 +23,7 @@ log = logging.getLogger(__name__)
EXTERNAL_GRADER_NO_CONTACT_ERROR
=
"Failed to contact external graders. Please notify course staff."
class
PeerGradingFields
(
object
):
use_for_single_location
=
Boolean
(
display_name
=
"Show Single Problem"
,
...
...
@@ -67,9 +68,11 @@ class PeerGradingFields(object):
scope
=
Scope
.
settings
,
default
=
"Peer Grading Interface"
)
data
=
String
(
help
=
"Html contents to display for this module"
,
data
=
String
(
help
=
"Html contents to display for this module"
,
default
=
'<peergrading></peergrading>'
,
scope
=
Scope
.
content
)
scope
=
Scope
.
content
)
class
PeerGradingModule
(
PeerGradingFields
,
XModule
):
...
...
@@ -78,11 +81,14 @@ class PeerGradingModule(PeerGradingFields, XModule):
"""
_VERSION
=
1
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/peergrading/peer_grading.coffee'
),
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/peergrading/peer_grading.coffee'
),
resource_string
(
__name__
,
'js/src/peergrading/peer_grading_problem.coffee'
),
resource_string
(
__name__
,
'js/src/collapsible.coffee'
),
resource_string
(
__name__
,
'js/src/javascript_loader.coffee'
),
]}
]
}
js_module_name
=
"PeerGrading"
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/combinedopenended/display.scss'
)]}
...
...
@@ -133,7 +139,6 @@ class PeerGradingModule(PeerGradingFields, XModule):
return
True
return
False
def
_err_response
(
self
,
msg
):
"""
Return a HttpResponse with a json dump with success=False, and the given error message.
...
...
@@ -307,31 +312,22 @@ class PeerGradingModule(PeerGradingFields, XModule):
error: if there was an error in the submission, this is the error message
"""
required
=
set
([
'location'
,
'submission_id'
,
'submission_key'
,
'score'
,
'feedback'
,
'rubric_scores[]'
,
'submission_flagged'
])
required
=
set
([
'location'
,
'submission_id'
,
'submission_key'
,
'score'
,
'feedback'
,
'rubric_scores[]'
,
'submission_flagged'
,
'answer_unknown'
])
success
,
message
=
self
.
_check_required
(
data
,
required
)
if
not
success
:
return
self
.
_err_response
(
message
)
grader_id
=
self
.
system
.
anonymous_student_id
location
=
data
.
get
(
'location'
)
submission_id
=
data
.
get
(
'submission_id'
)
score
=
data
.
get
(
'score'
)
feedback
=
data
.
get
(
'feedback'
)
submission_key
=
data
.
get
(
'submission_key'
)
rubric_scores
=
data
.
getlist
(
'rubric_scores[]'
)
submission_flagged
=
data
.
get
(
'submission_flagged'
)
data_dict
=
{
k
:
data
.
get
(
k
)
for
k
in
required
}
data_dict
[
'rubric_scores'
]
=
data
.
getlist
(
'rubric_scores[]'
)
data_dict
[
'grader_id'
]
=
self
.
system
.
anonymous_student_id
try
:
response
=
self
.
peer_gs
.
save_grade
(
location
,
grader_id
,
submission_id
,
score
,
feedback
,
submission_key
,
rubric_scores
,
submission_flagged
)
response
=
self
.
peer_gs
.
save_grade
(
**
data_dict
)
return
response
except
GradingServiceError
:
# This is a dev_facing_error
log
.
exception
(
"""Error saving grade to open ended grading service. server url: {0}, location: {1}, submission_id:{2},
submission_key: {3}, score: {4}"""
.
format
(
self
.
peer_gs
.
url
,
location
,
submission_id
,
submission_key
,
score
)
log
.
exception
(
"""Error saving grade to open ended grading service. server url: {0}"""
.
format
(
self
.
peer_gs
.
url
)
)
# This is a student_facing_error
return
{
...
...
@@ -450,27 +446,21 @@ class PeerGradingModule(PeerGradingFields, XModule):
success
,
message
=
self
.
_check_required
(
data
,
required
)
if
not
success
:
return
self
.
_err_response
(
message
)
grader_id
=
self
.
system
.
anonymous_student_id
location
=
data
.
get
(
'location'
)
calibration_essay_id
=
data
.
get
(
'submission_id'
)
submission_key
=
data
.
get
(
'submission_key'
)
score
=
data
.
get
(
'score'
)
feedback
=
data
.
get
(
'feedback'
)
rubric_scores
=
data
.
getlist
(
'rubric_scores[]'
)
data_dict
=
{
k
:
data
.
get
(
k
)
for
k
in
required
}
data_dict
[
'rubric_scores'
]
=
data
.
getlist
(
'rubric_scores[]'
)
data_dict
[
'student_id'
]
=
self
.
system
.
anonymous_student_id
data_dict
[
'calibration_essay_id'
]
=
data_dict
[
'submission_id'
]
try
:
response
=
self
.
peer_gs
.
save_calibration_essay
(
location
,
grader_id
,
calibration_essay_id
,
submission_key
,
score
,
feedback
,
rubric_scores
)
response
=
self
.
peer_gs
.
save_calibration_essay
(
**
data_dict
)
if
'actual_rubric'
in
response
:
rubric_renderer
=
combined_open_ended_rubric
.
CombinedOpenEndedRubric
(
self
.
system
,
True
)
response
[
'actual_rubric'
]
=
rubric_renderer
.
render_rubric
(
response
[
'actual_rubric'
])[
'html'
]
return
response
except
GradingServiceError
:
# This is a dev_facing_error
log
.
exception
(
"Error saving calibration grade, location: {0}, submission_key: {1}, grader_id: {2}"
.
format
(
location
,
submission_key
,
grader_id
))
log
.
exception
(
"Error saving calibration grade"
)
# This is a student_facing_error
return
self
.
_err_response
(
'There was an error saving your score. Please notify course staff.'
)
...
...
common/lib/xmodule/xmodule/tests/test_peer_grading.py
View file @
17c77dd1
...
...
@@ -28,6 +28,7 @@ class PeerGradingModuleTest(unittest.TestCase, DummyModulestore):
'feedback'
:
""
,
'rubric_scores[]'
:
[
0
,
1
],
'submission_flagged'
:
False
,
'answer_unknown'
:
False
,
})
def
setUp
(
self
):
...
...
lms/djangoapps/open_ended_grading/tests.py
View file @
17c77dd1
...
...
@@ -205,7 +205,9 @@ class TestPeerGradingService(LoginEnrollmentTestCase):
'submission_key'
:
'fake key'
,
'score'
:
2
,
'feedback'
:
'feedback'
,
'submission_flagged'
:
'false'
'submission_flagged'
:
'false'
,
'answer_unknown'
:
'false'
,
'rubric_scores_complete'
:
'true'
}
qdict
=
MagicMock
()
...
...
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