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
97655d03
Commit
97655d03
authored
Feb 07, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the requirement that the problem peer grading module
has to have a certain naming structure
parent
04f6d6d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
2 deletions
+57
-2
common/lib/xmodule/xmodule/peer_grading_module.py
+44
-1
lms/templates/peer_grading/peer_grading.html
+13
-1
No files found.
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
97655d03
...
...
@@ -32,6 +32,7 @@ from .stringify import stringify_children
from
.x_module
import
XModule
from
.xml_module
import
XmlDescriptor
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
from
timeinfo
import
TimeInfo
from
peer_grading_service
import
peer_grading_service
,
GradingServiceError
...
...
@@ -109,10 +110,14 @@ class PeerGradingModule(XModule):
self
.
max_grade
=
int
(
self
.
max_grade
)
def
closed
(
self
):
if
self
.
timeinfo
.
close_date
is
not
None
and
datetime
.
utcnow
()
>
self
.
timeinfo
.
close_date
:
return
self
.
_closed
(
self
.
timeinfo
)
def
_closed
(
self
,
timeinfo
):
if
timeinfo
.
close_date
is
not
None
and
datetime
.
utcnow
()
>
timeinfo
.
close_date
:
return
True
return
False
def
_err_response
(
self
,
msg
):
"""
Return a HttpResponse with a json dump with success=False, and the given error message.
...
...
@@ -456,6 +461,44 @@ class PeerGradingModule(XModule):
error_text
=
"Could not get problem list"
success
=
False
# grab all peer grading module descriptors for this course
peer_grading_modules
=
modulestore
()
.
get_items
([
'i4x'
,
self
.
location
.
org
,
self
.
location
.
course
,
'peergrading'
,
None
],
self
.
system
.
course_id
)
# construct a dictionary for fast lookups
module_dict
=
{}
for
module
in
peer_grading_modules
:
linked_location
=
module
.
metadata
.
get
(
"link_to_location"
,
None
)
if
linked_location
:
module_dict
[
linked_location
]
=
module
def
_find_corresponding_module_for_location
(
location
):
if
location
in
module_dict
:
return
module_dict
[
location
]
else
:
return
None
for
problem
in
problem_list
:
problem_location
=
problem
[
'location'
]
descriptor
=
_find_corresponding_module_for_location
(
problem_location
)
if
descriptor
:
problem
[
'due'
]
=
descriptor
.
metadata
.
get
(
'due'
,
None
)
grace_period_string
=
descriptor
.
metadata
.
get
(
'graceperiod'
,
None
)
try
:
problem_timeinfo
=
TimeInfo
(
problem
[
'due'
],
grace_period_string
)
except
:
log
.
error
(
"Malformed due date or grace period string for location {0}"
.
format
(
problem_location
))
raise
if
self
.
_closed
(
problem_timeinfo
):
problem
[
'closed'
]
=
True
else
:
problem
[
'closed'
]
=
False
else
:
# if we can't find the due date, assume that it doesn't have one
problem
[
'due'
]
=
None
problem
[
'closed'
]
=
False
ajax_url
=
self
.
ajax_url
html
=
self
.
system
.
render_template
(
'peer_grading/peer_grading.html'
,
{
'course_id'
:
self
.
system
.
course_id
,
...
...
lms/templates/peer_grading/peer_grading.html
View file @
97655d03
...
...
@@ -14,6 +14,7 @@
<table
class=
"problem-list"
>
<tr>
<th>
Problem Name
</th>
<th>
Due date
</th>
<th>
Graded
</th>
<th>
Available
</th>
<th>
Required
</th>
...
...
@@ -22,7 +23,18 @@
%for problem in problem_list:
<tr
data-graded=
"${problem['num_graded']}"
data-required=
"${problem['num_required']}"
>
<td
class=
"problem-name"
>
<a
href=
"#problem"
data-location=
"${problem['location']}"
class=
"problem-button"
>
${problem['problem_name']}
</a>
%if problem['closed']:
${problem['problem_name']}
%else:
<a
href=
"#problem"
data-location=
"${problem['location']}"
class=
"problem-button"
>
${problem['problem_name']}
</a>
%endif
</td>
<td>
% if problem['due']:
${problem['due']}
% else:
No due date
% endif
</td>
<td>
${problem['num_graded']}
...
...
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