Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
97655d03
Commit
97655d03
authored
12 years ago
by
Diana Huang
Browse files
Options
Downloads
Patches
Plain Diff
Remove the requirement that the problem peer grading module
has to have a certain naming structure
parent
04f6d6d0
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/lib/xmodule/xmodule/peer_grading_module.py
+44
-1
44 additions, 1 deletion
common/lib/xmodule/xmodule/peer_grading_module.py
lms/templates/peer_grading/peer_grading.html
+13
-1
13 additions, 1 deletion
lms/templates/peer_grading/peer_grading.html
with
57 additions
and
2 deletions
common/lib/xmodule/xmodule/peer_grading_module.py
+
44
−
1
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
,
...
...
This diff is collapsed.
Click to expand it.
lms/templates/peer_grading/peer_grading.html
+
13
−
1
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']}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment