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
78948210
Commit
78948210
authored
Feb 06, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use different template when peer grading is closed.
parent
977e1904
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
8 deletions
+35
-8
common/lib/xmodule/xmodule/peer_grading_module.py
+28
-8
lms/templates/peer_grading/peer_grading_closed.html
+7
-0
No files found.
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
78948210
...
@@ -20,6 +20,7 @@ import copy
...
@@ -20,6 +20,7 @@ import copy
import
itertools
import
itertools
import
json
import
json
import
logging
import
logging
import
datetime.datetime
from
lxml.html
import
rewrite_links
from
lxml.html
import
rewrite_links
import
os
import
os
from
pkg_resources
import
resource_string
from
pkg_resources
import
resource_string
...
@@ -71,6 +72,16 @@ class PeerGradingModule(XModule):
...
@@ -71,6 +72,16 @@ class PeerGradingModule(XModule):
self
.
system
=
system
self
.
system
=
system
self
.
peer_gs
=
peer_grading_service
(
self
.
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
)
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
)
#TODO: do we only want to allow this for single locations?
display_due_date_string
=
self
.
metadata
.
get
(
'due'
,
None
)
display_due_date_string
=
self
.
metadata
.
get
(
'due'
,
None
)
grace_period_string
=
self
.
metadata
.
get
(
'graceperiod'
,
None
)
grace_period_string
=
self
.
metadata
.
get
(
'graceperiod'
,
None
)
...
@@ -82,14 +93,6 @@ class PeerGradingModule(XModule):
...
@@ -82,14 +93,6 @@ class PeerGradingModule(XModule):
self
.
display_due_date
=
self
.
timeinfo
.
display_due_date
self
.
display_due_date
=
self
.
timeinfo
.
display_due_date
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
)
self
.
link_to_location
=
self
.
metadata
.
get
(
'link_to_location'
,
USE_FOR_SINGLE_LOCATION
)
if
self
.
use_for_single_location
==
True
:
if
self
.
use_for_single_location
==
True
:
#This will raise an exception if the location is invalid
#This will raise an exception if the location is invalid
...
@@ -105,6 +108,11 @@ class PeerGradingModule(XModule):
...
@@ -105,6 +108,11 @@ class PeerGradingModule(XModule):
#This could result in an exception, but not wrapping in a try catch block so it moves up the stack
#This could result in an exception, but not wrapping in a try catch block so it moves up the stack
self
.
max_grade
=
int
(
self
.
max_grade
)
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
True
return
False
def
_err_response
(
self
,
msg
):
def
_err_response
(
self
,
msg
):
"""
"""
Return a HttpResponse with a json dump with success=False, and the given error message.
Return a HttpResponse with a json dump with success=False, and the given error message.
...
@@ -124,6 +132,8 @@ class PeerGradingModule(XModule):
...
@@ -124,6 +132,8 @@ class PeerGradingModule(XModule):
Needs to be implemented by inheritors. Renders the HTML that students see.
Needs to be implemented by inheritors. Renders the HTML that students see.
@return:
@return:
"""
"""
if
self
.
closed
():
return
self
.
peer_grading_closed
()
if
not
self
.
use_for_single_location
:
if
not
self
.
use_for_single_location
:
return
self
.
peer_grading
()
return
self
.
peer_grading
()
else
:
else
:
...
@@ -410,6 +420,16 @@ class PeerGradingModule(XModule):
...
@@ -410,6 +420,16 @@ class PeerGradingModule(XModule):
log
.
exception
(
"Error saving calibration grade, location: {0}, submission_id: {1}, submission_key: {2}, grader_id: {3}"
.
format
(
location
,
submission_id
,
submission_key
,
grader_id
))
log
.
exception
(
"Error saving calibration grade, location: {0}, submission_id: {1}, submission_key: {2}, grader_id: {3}"
.
format
(
location
,
submission_id
,
submission_key
,
grader_id
))
return
self
.
_err_response
(
'Could not connect to grading service'
)
return
self
.
_err_response
(
'Could not connect to grading service'
)
def
peer_grading_closed
(
self
):
'''
Show the Peer grading closed template
'''
html
=
self
.
system
.
render_template
(
'peer_grading/peer_grading_closed.html'
,
{
'use_for_single_location'
:
self
.
use_single_location
})
return
html
def
peer_grading
(
self
,
get
=
None
):
def
peer_grading
(
self
,
get
=
None
):
'''
'''
Show a peer grading interface
Show a peer grading interface
...
...
lms/templates/peer_grading/peer_grading_closed.html
0 → 100644
View file @
78948210
<section
class=
"container peer-grading-container"
>
% if use_for_single_location:
<p>
Peer grading for this problem is closed at this time.
</p>
%else:
<p>
Peer grading is closed at this time.
</p>
%endif
</section>
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