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
c1583dbb
Commit
c1583dbb
authored
Jan 31, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly load javascript, fix templates to work with xmodule, modify AJAX handlers
parent
c2f64465
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
47 deletions
+47
-47
common/lib/xmodule/xmodule/js/src/peergrading/peer_grading.coffee
+8
-7
common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee
+0
-0
common/lib/xmodule/xmodule/peer_grading_module.py
+35
-38
common/lib/xmodule/xmodule/peer_grading_service.py
+2
-0
lms/templates/peer_grading/peer_grading.html
+1
-1
lms/templates/peer_grading/peer_grading_problem.html
+1
-1
No files found.
common/lib/xmodule/xmodule/js/src/peergrading/peer_grading.coffee
View file @
c1583dbb
...
...
@@ -2,11 +2,11 @@
# and message container when they are empty
# Can (and should be) expanded upon when our problem list
# becomes more sophisticated
class
PeerGrading
constructor
:
()
->
class
@
PeerGrading
constructor
:
(
element
)
->
@
peer_grading_container
=
$
(
'.peer-grading'
)
@
peer_grading_outer_container
=
$
(
'.peer-grading-container'
)
@
ajax_url
=
peer_grading_container
.
data
(
'ajax-url'
)
@
ajax_url
=
@
peer_grading_container
.
data
(
'ajax-url'
)
@
error_container
=
$
(
'.error-container'
)
@
error_container
.
toggle
(
not
@
error_container
.
is
(
':empty'
))
...
...
@@ -14,7 +14,7 @@ class PeerGrading
@
message_container
.
toggle
(
not
@
message_container
.
is
(
':empty'
))
@
problem_button
=
$
(
'.problem-button'
)
@
problem_button
.
click
show_results
@
problem_button
.
click
@
show_results
@
problem_list
=
$
(
'.problem-list'
)
@
construct_progress_bar
()
...
...
@@ -35,7 +35,7 @@ class PeerGrading
$
.
postWithPrefix
"
#{
@
ajax_url
}
problem"
,
data
,
(
response
)
=>
if
response
.
success
@
peer_grading_outer_container
.
after
(
response
.
html
).
remove
()
backend
=
new
PeerGradingProblemBackend
(
@
ajax_url
,
false
)
new
PeerGradingProblem
(
backend
)
else
@
gentle_alert
response
.
error
$
(
document
).
ready
(()
->
new
PeerGrading
())
@
gentle_alert
response
.
error
\ No newline at end of file
common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee
View file @
c1583dbb
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
c1583dbb
...
...
@@ -68,7 +68,6 @@ class PeerGradingModule(XModule):
system
.
set
(
'location'
,
location
)
self
.
system
=
system
self
.
peer_gs
=
peer_grading_service
()
log
.
debug
(
self
.
system
)
self
.
use_for_single_location
=
self
.
metadata
.
get
(
'use_for_single_location'
,
USE_FOR_SINGLE_LOCATION
)
if
isinstance
(
self
.
use_for_single_location
,
basestring
):
...
...
@@ -108,7 +107,7 @@ class PeerGradingModule(XModule):
Needs to be implemented by child modules. Handles AJAX events.
@return:
"""
log
.
debug
(
get
)
handlers
=
{
'get_next_submission'
:
self
.
get_next_submission
,
'show_calibration_essay'
:
self
.
show_calibration_essay
,
...
...
@@ -123,6 +122,8 @@ class PeerGradingModule(XModule):
d
=
handlers
[
dispatch
](
get
)
log
.
debug
(
d
)
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
def
get_progress
(
self
):
...
...
@@ -149,14 +150,12 @@ class PeerGradingModule(XModule):
'error': if success is False, will have an error message with more info.
"""
_check_post
(
request
)
required
=
set
([
'location'
])
success
,
message
=
_check_required
(
reques
t
,
required
)
success
,
message
=
self
.
_check_required
(
ge
t
,
required
)
if
not
success
:
return
_err_response
(
message
)
grader_id
=
unique_id_for_user
(
request
.
user
)
p
=
request
.
POST
location
=
p
[
'location'
]
grader_id
=
self
.
system
.
anonymous_student_id
location
=
get
[
'location'
]
try
:
response
=
self
.
peer_gs
.
get_next_submission
(
location
,
grader_id
)
...
...
@@ -183,20 +182,20 @@ class PeerGradingModule(XModule):
success: bool indicating whether the save was a success
error: if there was an error in the submission, this is the error message
"""
_check_post
(
request
)
required
=
set
([
'location'
,
'submission_id'
,
'submission_key'
,
'score'
,
'feedback'
,
'rubric_scores[]'
,
'submission_flagged'
])
success
,
message
=
_check_required
(
reques
t
,
required
)
success
,
message
=
self
.
_check_required
(
ge
t
,
required
)
if
not
success
:
return
_err_response
(
message
)
grader_id
=
unique_id_for_user
(
request
.
user
)
p
=
request
.
POST
location
=
p
[
'location'
]
submission_id
=
p
[
'submission_id'
]
score
=
p
[
'score'
]
feedback
=
p
[
'feedback'
]
submission_key
=
p
[
'submission_key'
]
rubric_scores
=
p
.
getlist
(
'rubric_scores[]'
)
submission_flagged
=
p
[
'submission_flagged'
]
grader_id
=
self
.
system
.
anonymous_student_id
location
=
get
[
'location'
]
submission_id
=
get
[
'submission_id'
]
score
=
get
[
'score'
]
feedback
=
get
[
'feedback'
]
submission_key
=
get
[
'submission_key'
]
rubric_scores
=
get
[
'rubric_scores'
]
submission_flagged
=
get
[
'submission_flagged'
]
try
:
response
=
self
.
peer_gs
.
save_grade
(
location
,
grader_id
,
submission_id
,
score
,
feedback
,
submission_key
,
rubric_scores
,
submission_flagged
)
...
...
@@ -227,14 +226,14 @@ class PeerGradingModule(XModule):
total_calibrated_on_so_far - the number of calibration essays for this problem
that this grader has graded
"""
_check_post
(
request
)
required
=
set
([
'location'
])
success
,
message
=
_check_required
(
reques
t
,
required
)
success
,
message
=
self
.
_check_required
(
ge
t
,
required
)
if
not
success
:
return
_err_response
(
message
)
grader_id
=
unique_id_for_user
(
request
.
user
)
p
=
request
.
POST
location
=
p
[
'location'
]
grader_id
=
self
.
system
.
anonymous_student_id
location
=
get
[
'location'
]
try
:
response
=
self
.
peer_gs
.
is_student_calibrated
(
location
,
grader_id
)
...
...
@@ -268,16 +267,15 @@ class PeerGradingModule(XModule):
'error': if success is False, will have an error message with more info.
"""
_check_post
(
request
)
required
=
set
([
'location'
])
success
,
message
=
_check_required
(
reques
t
,
required
)
success
,
message
=
self
.
_check_required
(
ge
t
,
required
)
if
not
success
:
return
_err_response
(
message
)
grader_id
=
unique_id_for_user
(
request
.
user
)
p
=
request
.
POST
location
=
p
[
'location'
]
grader_id
=
self
.
system
.
anonymous_student_id
location
=
get
[
'location'
]
try
:
response
=
self
.
peer_gs
.
show_calibration_essay
(
location
,
grader_id
)
return
HttpResponse
(
response
,
mimetype
=
"application/json"
)
...
...
@@ -311,20 +309,19 @@ class PeerGradingModule(XModule):
actual_score: the score that the instructor gave to this calibration essay
"""
_check_post
(
request
)
required
=
set
([
'location'
,
'submission_id'
,
'submission_key'
,
'score'
,
'feedback'
,
'rubric_scores[]'
])
success
,
message
=
_check_required
(
reques
t
,
required
)
success
,
message
=
self
.
_check_required
(
ge
t
,
required
)
if
not
success
:
return
_err_response
(
message
)
grader_id
=
unique_id_for_user
(
request
.
user
)
p
=
request
.
POST
location
=
p
[
'location'
]
calibration_essay_id
=
p
[
'submission_id'
]
submission_key
=
p
[
'submission_key'
]
score
=
p
[
'score'
]
feedback
=
p
[
'feedback'
]
rubric_scores
=
p
.
getlist
(
'rubric_scores[]'
)
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'
]
try
:
response
=
self
.
peer_gs
.
save_calibration_essay
(
location
,
grader_id
,
calibration_essay_id
,
...
...
common/lib/xmodule/xmodule/peer_grading_service.py
View file @
c1583dbb
...
...
@@ -48,6 +48,7 @@ class PeerGradingService():
'rubric_scores'
:
rubric_scores
,
'rubric_scores_complete'
:
True
,
'submission_flagged'
:
submission_flagged
}
log
.
debug
(
data
)
return
self
.
post
(
self
.
save_grade_url
,
data
)
def
is_student_calibrated
(
self
,
problem_location
,
grader_id
):
...
...
@@ -69,6 +70,7 @@ class PeerGradingService():
'feedback'
:
feedback
,
'rubric_scores[]'
:
rubric_scores
,
'rubric_scores_complete'
:
True
}
log
.
debug
(
data
)
return
self
.
post
(
self
.
save_calibration_essay_url
,
data
)
def
get_problem_list
(
self
,
course_id
,
grader_id
):
...
...
lms/templates/peer_grading/peer_grading.html
View file @
c1583dbb
<section
class=
"container peer-grading-container"
>
<div
class=
"peer-grading"
data-ajax
_
url=
"${ajax_url}"
>
<div
class=
"peer-grading"
data-ajax
-
url=
"${ajax_url}"
>
<div
class=
"error-container"
>
${error_text}
</div>
<h1>
Peer Grading
</h1>
<h2>
Instructions
</h2>
...
...
lms/templates/peer_grading/peer_grading_problem.html
View file @
c1583dbb
<section
class=
"container peer-grading-container"
>
<div
class=
"peer-grading"
data-ajax
_
url=
"${ajax_url}"
data-location=
"${problem_location}"
>
<div
class=
"peer-grading"
data-ajax
-
url=
"${ajax_url}"
data-location=
"${problem_location}"
>
<div
class=
"error-container"
></div>
<section
class=
"content-panel"
>
...
...
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