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
8027cc70
Commit
8027cc70
authored
Feb 05, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some issues with tests
parent
134f2f7a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
63 deletions
+20
-63
common/lib/xmodule/xmodule/peer_grading_module.py
+6
-6
common/lib/xmodule/xmodule/peer_grading_service.py
+8
-49
lms/djangoapps/open_ended_grading/tests.py
+6
-8
No files found.
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
8027cc70
...
...
@@ -384,12 +384,12 @@ class PeerGradingModule(XModule):
return
self
.
_err_response
(
message
)
grader_id
=
self
.
system
.
anonymous_student_id
location
=
get
[
'location'
]
calibration_essay_id
=
get
[
'submission_id'
]
submission_key
=
get
[
'submission_key'
]
score
=
get
[
'score'
]
feedback
=
get
[
'feedback'
]
rubric_scores
=
get
[
'rubric_scores[]'
]
location
=
get
.
get
(
'location'
)
calibration_essay_id
=
get
.
get
(
'submission_id'
)
submission_key
=
get
.
get
(
'submission_key'
)
score
=
get
.
get
(
'score'
)
feedback
=
get
.
get
(
'feedback'
)
rubric_scores
=
get
.
getlist
(
'rubric_scores[]'
)
try
:
response
=
self
.
peer_gs
.
save_calibration_essay
(
location
,
grader_id
,
calibration_essay_id
,
...
...
common/lib/xmodule/xmodule/peer_grading_service.py
View file @
8027cc70
...
...
@@ -39,12 +39,12 @@ class PeerGradingService(GradingService):
def
get_data_for_location
(
self
,
problem_location
,
student_id
):
response
=
self
.
get
(
self
.
get_data_for_location_url
,
{
'location'
:
problem_location
,
'student_id'
:
student_id
})
return
response
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
})
return
self
.
_render_rubric
(
response
)
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
,
...
...
@@ -56,16 +56,16 @@ class PeerGradingService(GradingService):
'rubric_scores'
:
rubric_scores
,
'rubric_scores_complete'
:
True
,
'submission_flagged'
:
submission_flagged
}
return
self
.
post
(
self
.
save_grade_url
,
data
)
return
self
.
try_to_decode
(
self
.
post
(
self
.
save_grade_url
,
data
)
)
def
is_student_calibrated
(
self
,
problem_location
,
grader_id
):
params
=
{
'problem_id'
:
problem_location
,
'student_id'
:
grader_id
}
return
self
.
get
(
self
.
is_student_calibrated_url
,
params
)
return
self
.
try_to_decode
(
self
.
get
(
self
.
is_student_calibrated_url
,
params
)
)
def
show_calibration_essay
(
self
,
problem_location
,
grader_id
):
params
=
{
'problem_id'
:
problem_location
,
'student_id'
:
grader_id
}
response
=
self
.
get
(
self
.
show_calibration_essay_url
,
params
)
return
self
.
_render_rubric
(
response
)
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
):
...
...
@@ -77,17 +77,17 @@ class PeerGradingService(GradingService):
'feedback'
:
feedback
,
'rubric_scores[]'
:
rubric_scores
,
'rubric_scores_complete'
:
True
}
return
self
.
post
(
self
.
save_calibration_essay_url
,
data
)
return
self
.
try_to_decode
(
self
.
post
(
self
.
save_calibration_essay_url
,
data
)
)
def
get_problem_list
(
self
,
course_id
,
grader_id
):
params
=
{
'course_id'
:
course_id
,
'student_id'
:
grader_id
}
response
=
self
.
get
(
self
.
get_problem_list_url
,
params
)
return
response
return
self
.
try_to_decode
(
response
)
def
get_notifications
(
self
,
course_id
,
grader_id
):
params
=
{
'course_id'
:
course_id
,
'student_id'
:
grader_id
}
response
=
self
.
get
(
self
.
get_notifications_url
,
params
)
return
response
return
self
.
try_to_decode
(
response
)
def
_login
(
self
):
"""
...
...
@@ -113,47 +113,6 @@ class PeerGradingService(GradingService):
return
text
def
post
(
self
,
url
,
data
,
allow_redirects
=
False
):
"""
Make a post request to the grading controller
"""
try
:
op
=
lambda
:
self
.
session
.
post
(
url
,
data
=
data
,
allow_redirects
=
allow_redirects
)
r
=
self
.
_try_with_login
(
op
)
except
(
RequestException
,
ConnectionError
,
HTTPError
)
as
err
:
# reraise as promised GradingServiceError, but preserve stacktrace.
raise
GradingServiceError
,
str
(
err
),
sys
.
exc_info
()[
2
]
text
=
r
.
text
try
:
text
=
json
.
loads
(
text
)
except
:
pass
return
text
def
get
(
self
,
url
,
params
,
allow_redirects
=
False
):
"""
Make a get request to the grading controller
"""
op
=
lambda
:
self
.
session
.
get
(
url
,
allow_redirects
=
allow_redirects
,
params
=
params
)
try
:
r
=
self
.
_try_with_login
(
op
)
except
(
RequestException
,
ConnectionError
,
HTTPError
)
as
err
:
# reraise as promised GradingServiceError, but preserve stacktrace.
raise
GradingServiceError
,
str
(
err
),
sys
.
exc_info
()[
2
]
text
=
r
.
text
try
:
text
=
json
.
loads
(
text
)
except
:
pass
return
text
def
_try_with_login
(
self
,
operation
):
"""
...
...
lms/djangoapps/open_ended_grading/tests.py
View file @
8027cc70
...
...
@@ -171,7 +171,7 @@ class TestPeerGradingService(ct.PageLoader):
self
.
assertEqual
(
d
[
'error'
],
"Missing required keys: location"
)
def
test_save_grade_success
(
self
):
data
=
'rubric_scores[]=1|rubric_scores[]=2|location='
+
location
+
'|submission_id=1|submission_key=fake key|score=2|feedback=feedback|submission_flagged=False'
data
=
'rubric_scores[]=1|rubric_scores[]=2|location='
+
self
.
location
+
'|submission_id=1|submission_key=fake key|score=2|feedback=feedback|submission_flagged=False'
qdict
=
QueryDict
(
data
.
replace
(
"|"
,
"&"
))
r
=
self
.
peer_module
.
save_grade
(
qdict
)
d
=
r
...
...
@@ -203,6 +203,8 @@ class TestPeerGradingService(ct.PageLoader):
r
=
self
.
peer_module
.
show_calibration_essay
(
data
)
d
=
r
log
.
debug
(
d
)
log
.
debug
(
type
(
d
))
self
.
assertTrue
(
d
[
'success'
])
self
.
assertIsNotNone
(
d
[
'submission_id'
])
self
.
assertIsNotNone
(
d
[
'prompt'
])
...
...
@@ -219,13 +221,9 @@ class TestPeerGradingService(ct.PageLoader):
self
.
assertEqual
(
d
[
'error'
],
"Missing required keys: location"
)
def
test_save_calibration_essay_success
(
self
):
data
=
{
'location'
:
self
.
location
,
'submission_id'
:
'1'
,
'submission_key'
:
'fake key'
,
'score'
:
'2'
,
'feedback'
:
'This is feedback'
,
'rubric_scores[]'
:
[
1
,
2
]}
r
=
self
.
peer_module
.
save_calibration_essay
(
data
)
data
=
'rubric_scores[]=1|rubric_scores[]=2|location='
+
self
.
location
+
'|submission_id=1|submission_key=fake key|score=2|feedback=feedback|submission_flagged=False'
qdict
=
QueryDict
(
data
.
replace
(
"|"
,
"&"
))
r
=
self
.
peer_module
.
save_calibration_essay
(
qdict
)
d
=
r
self
.
assertTrue
(
d
[
'success'
])
self
.
assertTrue
(
'actual_score'
in
d
)
...
...
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