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
bd47b0c7
Commit
bd47b0c7
authored
Jan 03, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New urls and corresponding views in the grading service
parent
c89ff2ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
5 deletions
+85
-5
lms/djangoapps/open_ended_grading/peer_grading_service.py
+79
-4
lms/urls.py
+6
-1
No files found.
lms/djangoapps/open_ended_grading/peer_grading_service.py
View file @
bd47b0c7
...
...
@@ -118,11 +118,58 @@ def get_next_submission(request, course_id):
mimetype
=
"application/json"
)
def
_get_next_submission
(
course_id
,
grader_id
,
location
):
try
:
return
peer_grading_service
()
.
get_next_submission
(
location
,
grader_id
)
except
GradingServiceError
:
log
.
exception
(
"Error from grading service. server url: {0}"
.
format
(
staff_grading_service
()
.
url
))
return
json
.
dumps
({
'success'
:
False
,
'error'
:
'Could not connect to grading service'
})
def
save_grade
(
request
,
course_id
):
"""
Implementation of get_next (also called from save_grade) -- returns a json string
TODO: fill in this documentation
"""
_check_post
(
request
)
required
=
set
([
'location'
,
'grader_id'
,
'submission_id'
,
'submission_key'
,
'score'
,
'feedback'
])
success
,
message
=
_check_required
(
request
,
required
)
if
not
success
:
return
_err_response
(
message
)
grader_id
=
request
.
user
.
id
p
=
request
.
POST
location
=
p
[
'location'
]
submission_id
=
p
[
'submission_id'
]
score
=
p
[
'score'
]
feedback
=
p
[
'feedback'
]
submission_key
=
p
[
'submission_key'
]
try
:
return
peer_grading_service
()
.
get_next_submission
(
location
,
grader_id
)
response
=
peer_grading_service
()
.
save_grade
(
grader_id
,
submission_id
,
score
,
feedback
,
submission_key
)
return
HttpResponse
(
response
,
mimetype
=
"application/json"
)
except
GradingServiceError
:
log
.
exception
(
"Error from grading service. server url: {0}"
.
format
(
staff_grading_service
()
.
url
))
return
json
.
dumps
({
'success'
:
False
,
'error'
:
'Could not connect to grading service'
})
def
is_student_calibrated
(
request
,
course_id
):
"""
TODO: fill in this documentation
"""
_check_post
(
request
)
required
=
set
([
'location'
])
success
,
message
=
_check_required
(
request
,
required
)
if
not
success
:
return
_err_response
(
message
)
grader_id
=
request
.
user
.
id
p
=
request
.
POST
location
=
p
[
'location'
]
try
:
response
=
peer_grading_service
()
.
is_student_calibrated
(
location
,
grader_id
)
return
HttpResponse
(
response
,
mimetype
=
"application/json"
)
except
GradingServiceError
:
log
.
exception
(
"Error from grading service. server url: {0}"
.
format
(
staff_grading_service
()
.
url
))
...
...
@@ -130,6 +177,7 @@ def _get_next_submission(course_id, grader_id, location):
'error'
:
'Could not connect to grading service'
})
def
show_calibration_essay
(
request
,
course_id
):
"""
TODO: fill in this documentation
...
...
@@ -144,12 +192,39 @@ def show_calibration_essay(request, course_id):
grader_id
=
request
.
user
.
id
p
=
request
.
POST
location
=
p
[
'location'
]
return
HttpResponse
(
_next_calibration_essay
(
course_id
,
grader_id
,
location
),
mimetype
=
"application/json"
)
def
_next_calibration_essay
(
course_id
,
grader_id
,
location
):
try
:
response
=
peer_grading_service
()
.
show_calibration_essay
(
location
,
grader_id
)
return
HttpResponse
(
response
,
mimetype
=
"application/json"
)
return
peer_grading_service
()
.
show_calibration_essay
(
location
,
grader_id
)
except
GradingServiceError
:
log
.
exception
(
"Error from grading service. server url: {0}"
.
format
(
staff_grading_service
()
.
url
))
return
json
.
dumps
({
'success'
:
False
,
'error'
:
'Could not connect to grading service'
})
def
save_calibration_essay
(
request
,
course_id
):
"""
"""
_check_post
(
request
)
required
=
set
([
'location'
,
'calibration_essay_id'
,
'submission_key'
,
'score'
,
'feedback'
])
success
,
message
=
_check_required
(
request
,
required
)
if
not
success
:
return
_err_response
(
message
)
grader_id
=
request
.
user
.
id
p
=
request
.
POST
location
=
p
[
'location'
]
calibration_essay_id
=
p
[
'calibration_essay_id'
]
submission_key
=
p
[
'submission_key'
]
score
=
p
[
'score'
]
feedback
=
p
[
'feedback'
]
try
:
response
=
peer_grading_service
()
.
save_calibration_essay
(
location
,
grader_id
,
calibration_essay_id
,
submission_key
,
score
,
feedback
)
return
HttpResponse
(
response
,
mimetype
=
"application/json"
)
except
GradingServiceError
:
log
.
exception
(
"Error saving calibration grade"
)
return
_err_response
(
'Could not connect to grading service'
)
lms/urls.py
View file @
bd47b0c7
...
...
@@ -261,7 +261,12 @@ if settings.COURSEWARE_ENABLED:
'open_ended_grading.peer_grading_service.get_next_submission'
,
name
=
'peer_grading_get_next_submission'
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/show_calibration_essay$'
,
'open_ended_grading.peer_grading_service.show_calibration_essay'
,
name
=
'peer_grading_show_calibration_essay'
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/is_student_calibrated$'
,
'open_ended_grading.peer_grading_service.is_student_calibrated'
,
name
=
'peer_grading_is_student_calibrated'
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/save_grade$'
,
'open_ended_grading.peer_grading_service.save_grade'
,
name
=
'peer_grading_save_grade'
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/save_calibration_essay$'
,
'open_ended_grading.peer_grading_service.save_calibration_essay'
,
name
=
'peer_grading_save_calibration_essay'
),
)
# discussion forums live within courseware, so courseware must be enabled first
...
...
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