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
cbd0895a
Commit
cbd0895a
authored
Feb 04, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in single peer grading problem view
parent
c9f75f8b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
23 deletions
+41
-23
common/lib/xmodule/xmodule/js/src/peergrading/peer_grading.coffee
+10
-2
common/lib/xmodule/xmodule/peer_grading_module.py
+29
-19
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 @
cbd0895a
...
...
@@ -5,6 +5,7 @@
class
@
PeerGrading
constructor
:
(
element
)
->
@
peer_grading_container
=
$
(
'.peer-grading'
)
@
use_single_location
=
@
peer_grading_container
.
data
(
'use-single-location'
)
@
peer_grading_outer_container
=
$
(
'.peer-grading-container'
)
@
ajax_url
=
@
peer_grading_container
.
data
(
'ajax-url'
)
@
error_container
=
$
(
'.error-container'
)
...
...
@@ -19,6 +20,9 @@ class @PeerGrading
@
problem_list
=
$
(
'.problem-list'
)
@
construct_progress_bar
()
if
@
use_single_location
@
activate_problem
()
construct_progress_bar
:
()
=>
problems
=
@
problem_list
.
find
(
'tr'
).
next
()
problems
.
each
(
(
index
,
element
)
=>
...
...
@@ -38,4 +42,8 @@ class @PeerGrading
backend
=
new
PeerGradingProblemBackend
(
@
ajax_url
,
false
)
new
PeerGradingProblem
(
backend
)
else
@
gentle_alert
response
.
error
\ No newline at end of file
@
gentle_alert
response
.
error
activate_problem
:
()
=>
backend
=
new
PeerGradingProblemBackend
(
@
ajax_url
,
false
)
new
PeerGradingProblem
(
backend
)
\ No newline at end of file
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
cbd0895a
...
...
@@ -41,7 +41,7 @@ USE_FOR_SINGLE_LOCATION = False
LINK_TO_LOCATION
=
""
TRUE_DICT
=
[
True
,
"True"
,
"true"
,
"TRUE"
]
MAX_SCORE
=
1
IS_GRADED
=
True
class
PeerGradingModule
(
XModule
):
_VERSION
=
1
...
...
@@ -71,10 +71,14 @@ class PeerGradingModule(XModule):
self
.
system
=
system
self
.
peer_gs
=
peer_grading_service
(
self
.
system
)
self
.
use_for_single_location
=
self
.
metadata
.
get
(
'use_for_single_location'
,
use_for_single_location
)
self
.
use_for_single_location
=
self
.
metadata
.
get
(
'use_for_single_location'
,
USE_FOR_SINGLE_LOCATION
)
if
isinstance
(
self
.
use_for_single_location
,
basestring
):
self
.
use_for_single_location
=
(
self
.
use_for_single_location
in
TRUE_DICT
)
self
.
is_graded
=
self
.
metadata
.
get
(
'is_graded'
,
IS_GRADED
)
if
isinstance
(
self
.
is_graded
,
basestring
):
self
.
is_graded
=
(
self
.
is_graded
in
TRUE_DICT
)
self
.
link_to_location
=
self
.
metadata
.
get
(
'link_to_location'
,
USE_FOR_SINGLE_LOCATION
)
if
self
.
use_for_single_location
==
True
:
#This will raise an exception if the location is invalid
...
...
@@ -85,10 +89,10 @@ class PeerGradingModule(XModule):
self
.
ajax_url
=
self
.
ajax_url
+
"/"
self
.
student_data_for_location
=
instance_state
.
get
(
'student_data_for_location'
,
{})
self
.
max_
score
=
instance_state
.
get
(
'max_scor
e'
,
MAX_SCORE
)
if
not
isinstance
(
self
.
max_
scor
e
,
(
int
,
long
)):
self
.
max_
grade
=
instance_state
.
get
(
'max_grad
e'
,
MAX_SCORE
)
if
not
isinstance
(
self
.
max_
grad
e
,
(
int
,
long
)):
#This could result in an exception, but not wrapping in a try catch block so it moves up the stack
self
.
max_
score
=
int
(
self
.
max_scor
e
)
self
.
max_
grade
=
int
(
self
.
max_grad
e
)
def
_err_response
(
self
,
msg
):
"""
...
...
@@ -112,7 +116,7 @@ class PeerGradingModule(XModule):
if
not
self
.
use_for_single_location
:
return
self
.
peer_grading
()
else
:
return
self
.
peer_grading_problem
({
'location'
:
self
.
link_to_location
})
return
self
.
peer_grading_problem
({
'location'
:
self
.
link_to_location
})
[
'html'
]
def
handle_ajax
(
self
,
dispatch
,
get
):
"""
...
...
@@ -142,7 +146,7 @@ class PeerGradingModule(XModule):
response
=
{}
try
:
response
=
self
.
peer_gs
.
get_data_for_location
(
location
,
grader
_id
)
response
=
self
.
peer_gs
.
get_data_for_location
(
location
,
student
_id
)
count_graded
=
response
[
'count_graded'
]
count_required
=
response
[
'count_required'
]
success
=
True
...
...
@@ -156,7 +160,7 @@ class PeerGradingModule(XModule):
pass
def
get_score
(
self
):
if
not
self
.
use_for_single_location
:
if
not
self
.
use_for_single_location
or
not
self
.
is_graded
:
return
None
try
:
...
...
@@ -176,7 +180,7 @@ class PeerGradingModule(XModule):
score_dict
=
{
'score'
:
int
(
count_graded
>=
count_required
),
'total'
:
self
.
max_
scor
e
,
'total'
:
self
.
max_
grad
e
,
}
return
score_dict
...
...
@@ -187,10 +191,10 @@ class PeerGradingModule(XModule):
* This is generic; in abstract, a problem could be 3/5 points on one
randomization, and 5/7 on another
'''
max_
scor
e
=
None
if
self
.
use_for_single_location
:
max_
score
=
self
.
max_scor
e
return
max_
scor
e
max_
grad
e
=
None
if
self
.
use_for_single_location
and
self
.
is_graded
:
max_
grade
=
self
.
max_grad
e
return
max_
grad
e
def
get_next_submission
(
self
,
get
):
"""
...
...
@@ -430,7 +434,9 @@ class PeerGradingModule(XModule):
'problem_list'
:
problem_list
,
'error_text'
:
error_text
,
# Checked above
'staff_access'
:
False
,
})
'staff_access'
:
False
,
'use_single_location'
:
self
.
use_for_single_location
,
})
return
html
...
...
@@ -438,12 +444,14 @@ class PeerGradingModule(XModule):
'''
Show individual problem interface
'''
if
get
==
None
:
problem_location
=
self
.
system
.
location
if
get
==
None
or
get
.
get
(
'location'
)
==
None
:
if
not
self
.
use_for_single_location
:
#This is an error case, because it must be set to use a single location to be called without get parameters
return
{
'html'
:
""
,
'success'
:
False
}
problem_location
=
self
.
link_to_location
elif
get
.
get
(
'location'
)
is
not
None
:
problem_location
=
get
.
get
(
'location'
)
else
:
problem_location
=
self
.
system
.
location
ajax_url
=
self
.
ajax_url
html
=
self
.
system
.
render_template
(
'peer_grading/peer_grading_problem.html'
,
{
...
...
@@ -452,7 +460,9 @@ class PeerGradingModule(XModule):
'course_id'
:
self
.
system
.
course_id
,
'ajax_url'
:
ajax_url
,
# Checked above
'staff_access'
:
False
,
})
'staff_access'
:
False
,
'use_single_location'
:
self
.
use_for_single_location
,
})
return
{
'html'
:
html
,
'success'
:
True
}
...
...
lms/templates/peer_grading/peer_grading.html
View file @
cbd0895a
<section
class=
"container peer-grading-container"
>
<div
class=
"peer-grading"
data-ajax-url=
"${ajax_url}"
>
<div
class=
"peer-grading"
data-ajax-url=
"${ajax_url}"
data-use-single-location=
"${use_single_location}"
>
<div
class=
"error-container"
>
${error_text}
</div>
<h1>
Peer Grading
</h1>
<h2>
Instructions
</h2>
...
...
lms/templates/peer_grading/peer_grading_problem.html
View file @
cbd0895a
<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}"
data-use-single-location=
"${use_single_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