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
37f261f9
Commit
37f261f9
authored
Jan 02, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move peer grading so that there are the individual problem pages
and the problem list page
parent
deffa188
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
164 additions
and
7 deletions
+164
-7
lms/djangoapps/open_ended_grading/peer_grading_service.py
+31
-4
lms/djangoapps/open_ended_grading/views.py
+68
-0
lms/static/coffee/src/peer_grading/peer_grading.coffee
+9
-0
lms/static/coffee/src/peer_grading/peer_grading_problem.coffee
+17
-0
lms/static/sass/course/_staff_grading.scss
+2
-1
lms/templates/peer_grading/peer_grading.html
+13
-2
lms/templates/peer_grading/peer_grading_problem.html
+22
-0
lms/urls.py
+2
-0
No files found.
lms/djangoapps/open_ended_grading/peer_grading_service.py
View file @
37f261f9
...
...
@@ -24,12 +24,14 @@ class PeerGradingService(GradingService):
self
.
get_next_submission_url
=
self
.
url
+
'/get_next_submission/'
self
.
save_grade_url
=
self
.
url
+
'/save_grade/'
self
.
is_student_calibrated_url
=
self
.
url
+
'/is_student_calibrated/'
self
.
show_calibration_essay
=
self
.
url
+
'/show_calibration_essay/'
self
.
save_calibration_essay
=
self
.
url
+
'/save_calibration_essay/'
self
.
show_calibration_essay_url
=
self
.
url
+
'/show_calibration_essay/'
self
.
save_calibration_essay_url
=
self
.
url
+
'/save_calibration_essay/'
self
.
get_problem_list_url
=
self
.
url
+
'/get_problem_list/'
def
get_next_submission
(
self
,
problem_location
,
grader_id
):
re
turn
self
.
get
(
self
.
get_next_submission_url
,
False
,
re
sponse
=
self
.
get
(
self
.
get_next_submission_url
,
False
,
{
'location'
:
problem_location
,
'grader_id'
:
grader_id
})
return
response
def
save_grade
(
self
,
grader_id
,
submission_id
,
score
,
feedback
,
submission_key
):
data
=
{
'grader_id'
:
grader_id
,
...
...
@@ -39,6 +41,29 @@ class PeerGradingService(GradingService):
'submission_key'
:
submission_key
}
return
self
.
post
(
self
.
save_grade_url
,
False
,
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
,
False
,
params
)
def
show_calibration_essay
(
self
,
problem_location
,
grader_id
):
params
=
{
'problem_id'
:
problem_location
,
'student_id'
:
grader_id
}
return
self
.
get
(
self
.
show_calibration_essay_url
,
False
,
params
)
def
save_calibration_essay
(
self
,
problem_location
,
grader_id
,
calibration_essay_id
,
submission_key
,
score
,
feedback
):
data
=
{
'location'
:
problem_location
,
'student_id'
:
grader_id
,
'calibration_essay_id'
:
calibration_essay_id
,
'submission_key'
:
submission_key
,
'score'
:
score
,
'feedback'
:
feedback
}
return
self
.
post
(
self
.
save_calibration_essay_url
,
False
,
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
,
False
,
params
)
log
.
debug
(
"Response! {0}"
.
format
(
response
))
return
response
def
peer_grading_service
():
"""
...
...
@@ -64,6 +89,9 @@ def _err_response(msg):
mimetype
=
"application/json"
)
def
get_next_submission
(
request
,
course_id
):
"""
TODO: fill in this documentation
"""
required
=
set
([
'location'
])
if
request
.
method
!=
'POST'
:
raise
Http404
...
...
@@ -91,4 +119,3 @@ def _get_next_submission(course_id, grader_id, location):
return
json
.
dumps
({
'success'
:
False
,
'error'
:
'Could not connect to grading service'
})
lms/djangoapps/open_ended_grading/views.py
View file @
37f261f9
...
...
@@ -26,6 +26,10 @@ from xmodule.modulestore import Location
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
InvalidLocationError
,
ItemNotFoundError
,
NoPathToItem
from
xmodule.modulestore.search
import
path_to_location
from
peer_grading_service
import
PeerGradingService
from
grading_service
import
GradingServiceError
import
json
import
track.views
from
.staff_grading
import
StaffGrading
...
...
@@ -34,6 +38,8 @@ from .staff_grading import StaffGrading
log
=
logging
.
getLogger
(
__name__
)
template_imports
=
{
'urllib'
:
urllib
}
peer_gs
=
PeerGradingService
(
settings
.
PEER_GRADING_INTERFACE
)
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
def
staff_grading
(
request
,
course_id
):
"""
...
...
@@ -62,6 +68,22 @@ def peer_grading(request, course_id):
'''
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
# call problem list service
success
=
False
error_text
=
""
try
:
problem_list_text
=
peer_gs
.
get_problem_list
(
course_id
,
request
.
user
.
id
)
problem_list_json
=
json
.
loads
(
problem_list_text
)
success
=
problem_list_json
[
'success'
]
if
'error'
in
problem_list_json
:
error_text
=
problem_list_json
[
'error'
]
problem_list
=
problem_list_json
[
'problem_list'
]
except
GradingServiceError
:
error_text
=
"Error occured while contacting the grading service"
success
=
False
ajax_url
=
reverse
(
'peer_grading'
,
kwargs
=
{
'course_id'
:
course_id
})
if
not
ajax_url
.
endswith
(
'/'
):
ajax_url
+=
'/'
...
...
@@ -71,6 +93,52 @@ def peer_grading(request, course_id):
'course'
:
course
,
'course_id'
:
course_id
,
'ajax_url'
:
ajax_url
,
'success'
:
success
,
'problem_list'
:
problem_list
,
'error_text'
:
error_text
,
# Checked above
'staff_access'
:
False
,
})
def
peer_grading_problem
(
request
,
course_id
,
problem_location
):
'''
Show individual problem interface
'''
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
# TODO: make sure that we show calibration or next submission correctly
# TODO: figure out if we want to make this page pure ajax or not
problem_info_text
=
""
error_text
=
""
# if we are still in calibration
# show a calibration essay
# else, show an actual problem
try
:
problem_info_text
=
peer_gs
.
get_next_submission
(
problem_location
,
request
.
user
.
id
)
log
.
debug
(
problem_info_text
)
problem_info
=
json
.
loads
(
problem_info_text
)
success
=
problem_info
[
'success'
]
if
'error'
in
problem_info
:
error_text
=
problem_info
[
'error'
]
except
GradingServiceError
:
success
=
False
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_problem.html'
,
{
'view_html'
:
''
,
'course'
:
course
,
'course_id'
:
course_id
,
'success'
:
success
,
'problem_info'
:
problem_info_text
,
'ajax_url'
:
ajax_url
,
'error_text'
:
error_text
,
# Checked above
'staff_access'
:
False
,
})
...
...
lms/static/coffee/src/peer_grading/peer_grading.coffee
0 → 100644
View file @
37f261f9
class
PeerGrading
constructor
:
(
backend
)
->
@
problem_list
=
$
(
'.problem-list'
)
@
error_container
=
$
(
'.error-container'
)
@
error_container
.
toggle
(
not
@
error_container
.
is
(
':empty'
))
backend
=
{}
$
(
document
).
ready
(()
->
new
PeerGrading
(
backend
))
lms/static/coffee/src/peer_grading/peer_grading_problem.coffee
0 → 100644
View file @
37f261f9
class
PeerGradingProblemBackend
constructor
:
(
ajax_url
,
mock_backend
)
->
@
mock_backend
=
mock_backend
class
PeerGradingProblem
constructor
:
(
backend
)
->
@
error_container
=
$
(
'.error-container'
)
@
render_problem
()
render_problem
:
()
->
# do this when it makes sense
@
error_container
.
toggle
(
not
@
error_container
.
is
(
':empty'
))
backend
=
{}
$
(
document
).
ready
(()
->
new
PeerGradingProblem
(
backend
))
lms/static/sass/course/_staff_grading.scss
View file @
37f261f9
div
.staff-grading
{
div
.staff-grading
,
div
.peer-grading
{
textarea
.feedback-area
{
height
:
75px
;
margin
:
20px
;
...
...
lms/templates/peer_grading/peer_grading.html
View file @
37f261f9
...
...
@@ -16,7 +16,18 @@
<section
class=
"container"
>
<div
class=
"peer-grading"
data-ajax_url=
"${ajax_url}"
>
<div
class=
"problem-list"
>
</div>
<div
class=
"error-container"
>
${error_text}
</div>
<h1>
Peer Grading
</h1>
<h2>
Instructions
</h2>
<p></p>
% if success:
<ul
class=
"problem-list"
>
%for problem in problem_list:
<li>
<a
href=
"${ajax_url}/problem/${problem.location}"
>
${problem.location} (${problem.num_graded} graded, ${problem.num_pending} pending)
</a>
</li>
%endfor
</ul>
%endif
</div>
</section>
lms/templates/peer_grading/peer_grading_problem.html
0 → 100644
View file @
37f261f9
<
%
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"
data-ajax_url=
"${ajax_url}"
>
<div
class=
"error-container"
>
${error_text}
</div>
</div>
</section>
lms/urls.py
View file @
37f261f9
...
...
@@ -254,6 +254,8 @@ 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$'
,
'open_ended_grading.views.peer_grading'
,
name
=
'peer_grading'
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/problem/(?P<problem_location>.*)$'
,
'open_ended_grading.views.peer_grading_problem'
,
name
=
'peer_grading_problem'
),
)
...
...
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