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
652a8eb4
Commit
652a8eb4
authored
Dec 28, 2012
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New peer grading view on the lms side
parent
d23eb93f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
3 deletions
+112
-3
lms/djangoapps/open_ended_grading/peer_grading_service.py
+55
-1
lms/djangoapps/open_ended_grading/views.py
+21
-1
lms/envs/common.py
+5
-1
lms/templates/instructor/staff_grading.html
+4
-0
lms/templates/peer_grading/peer_grading.html
+22
-0
lms/urls.py
+5
-0
No files found.
lms/djangoapps/open_ended_grading/peer_grading_service.py
View file @
652a8eb4
...
...
@@ -36,5 +36,59 @@ class PeerGradingService(GradingService):
'submission_id'
:
submission_id
,
'score'
:
score
,
'feedback'
:
feedback
,
'submission_key'
,
submission_key
}
'submission_key'
:
submission_key
}
return
self
.
post
(
self
.
save_grade_url
,
False
,
data
)
def
peer_grading_service
():
"""
Return a peer grading service instance--if settings.MOCK_PEER_GRADING is True,
returns a mock one, otherwise a real one.
Caches the result, so changing the setting after the first call to this
function will have no effect.
"""
global
_service
if
_service
is
not
None
:
return
_service
_service
=
PeerGradingService
(
settings
.
PEER_GRADING_INTERFACE
)
return
_service
def
_err_response
(
msg
):
"""
Return a HttpResponse with a json dump with success=False, and the given error message.
"""
return
HttpResponse
(
json
.
dumps
({
'success'
:
False
,
'error'
:
msg
}),
mimetype
=
"application/json"
)
def
get_next_submission
(
request
,
course_id
):
required
=
set
([
'location'
])
if
request
.
method
!=
'POST'
:
raise
Http404
actual
=
set
(
request
.
POST
.
keys
())
missing
=
required
-
actual
if
len
(
missing
)
>
0
:
return
_err_response
(
'Missing required keys {0}'
.
format
(
', '
.
join
(
missing
)))
grader_id
=
request
.
user
.
id
p
=
request
.
POST
location
=
p
[
'location'
]
return
HttpResponse
(
_get_next
(
course_id
,
request
.
user
.
id
,
location
),
mimetype
=
"application/json"
)
def
_get_next_submission
(
course_id
,
grader_id
,
location
):
"""
Implementation of get_next (also called from save_grade) -- returns a json string
"""
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'
})
lms/djangoapps/open_ended_grading/views.py
View file @
652a8eb4
...
...
@@ -48,10 +48,30 @@ def staff_grading(request, course_id):
ajax_url
+=
'/'
return
render_to_response
(
'instructor/staff_grading.html'
,
{
'view_html'
:
grading
.
get_html
()
,
'view_html'
:
''
,
'course'
:
course
,
'course_id'
:
course_id
,
'ajax_url'
:
ajax_url
,
# Checked above
'staff_access'
:
True
,
})
def
peer_grading
(
request
,
course_id
):
'''
Show a peer grading interface
'''
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
ajax_url
=
reverse
(
'peer_grading'
,
kwargs
=
{
'course_id'
:
course_id
})
if
not
ajax_url
.
endswith
(
'/'
):
ajax_url
+=
'/'
return
render_to_response
(
'peer_grading/peer_grading.html'
,
{
'view_html'
:
''
,
'course'
:
course
,
'course_id'
:
course_id
,
'ajax_url'
:
ajax_url
,
# Checked above
'staff_access'
:
False
,
})
lms/envs/common.py
View file @
652a8eb4
...
...
@@ -418,6 +418,7 @@ main_vendor_js = [
discussion_js
=
sorted
(
glob2
.
glob
(
PROJECT_ROOT
/
'static/coffee/src/discussion/**/*.coffee'
))
staff_grading_js
=
sorted
(
glob2
.
glob
(
PROJECT_ROOT
/
'static/coffee/src/staff_grading/**/*.coffee'
))
peer_grading_js
=
sorted
(
glob2
.
glob
(
PROJECT_ROOT
/
'static/coffee/src/peer_grading/**/*.coffee'
))
# Load javascript from all of the available xmodules, and
...
...
@@ -526,8 +527,11 @@ PIPELINE_JS = {
'staff_grading'
:
{
'source_filenames'
:
[
pth
.
replace
(
PROJECT_ROOT
/
'static/'
,
''
)
for
pth
in
staff_grading_js
],
'output_filename'
:
'js/staff_grading.js'
},
'peer_grading'
:
{
'source_filenames'
:
[
pth
.
replace
(
PROJECT_ROOT
/
'static/'
,
''
)
for
pth
in
peer_grading_js
],
'output_filename'
:
'js/peer_grading.js'
}
}
PIPELINE_DISABLE_WRAPPER
=
True
...
...
lms/templates/instructor/staff_grading.html
View file @
652a8eb4
...
...
@@ -24,6 +24,8 @@
</div>
<div
class=
"message-container"
>
</div>
<
!
--
Problem
List
View
--
>
<section
class=
"problem-list-container"
>
<h2>
Instructions
</h2>
<div
class=
"instructions"
>
...
...
@@ -35,6 +37,8 @@
</ul>
</section>
<!-- Grading View -->
<section
class=
"prompt-wrapper"
>
<h2
class=
"prompt-name"
></h2>
<div
class=
"meta-info-wrapper"
>
...
...
lms/templates/peer_grading/peer_grading.html
0 → 100644
View file @
652a8eb4
<
%
inherit
file=
"/main.html"
/>
<
%
block
name=
"bodyclass"
>
${course.css_class}
</
%
block>
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
</
%
block>
<
%
block
name=
"title"
><title>
${course.number} Peer Grading
</title></
%
block>
<
%
include
file=
"/courseware/course_navigation.html"
args=
"active_page='staff_grading'"
/>
<
%
block
name=
"js_extra"
>
<
%
static:js
group=
'peer_grading'
/>
</
%
block>
<section
class=
"container"
>
<div
class=
"peer-grading"
>
<div
class=
"problem-list"
>
</div>
</div>
</section>
lms/urls.py
View file @
652a8eb4
...
...
@@ -250,6 +250,11 @@ if settings.COURSEWARE_ENABLED:
'open_ended_grading.staff_grading_service.save_grade'
,
name
=
'staff_grading_save_grade'
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/staff_grading/get_problem_list$'
,
'open_ended_grading.staff_grading_service.get_problem_list'
,
name
=
'staff_grading_get_problem_list'
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/get_next_submission$'
,
'open_ended_grading.peer_grading_service.get_next_submission'
,
name
=
'peer_grading_get_next_submission'
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading$'
,
'open_ended_grading.views.peer_grading'
,
name
=
'peer_grading'
),
)
# 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