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
ed282c05
Commit
ed282c05
authored
Feb 04, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proper handling of submissions
parent
6cf2742e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
common/lib/xmodule/xmodule/peer_grading_module.py
+10
-5
No files found.
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
ed282c05
...
@@ -38,8 +38,10 @@ from peer_grading_service import peer_grading_service, GradingServiceError
...
@@ -38,8 +38,10 @@ from peer_grading_service import peer_grading_service, GradingServiceError
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
USE_FOR_SINGLE_LOCATION
=
False
USE_FOR_SINGLE_LOCATION
=
False
LINK_TO_LOCATION
=
""
TRUE_DICT
=
[
True
,
"True"
,
"true"
,
"TRUE"
]
TRUE_DICT
=
[
True
,
"True"
,
"true"
,
"TRUE"
]
class
PeerGradingModule
(
XModule
):
class
PeerGradingModule
(
XModule
):
_VERSION
=
1
_VERSION
=
1
...
@@ -60,19 +62,24 @@ class PeerGradingModule(XModule):
...
@@ -60,19 +62,24 @@ class PeerGradingModule(XModule):
# Load instance state
# Load instance state
if
instance_state
is
not
None
:
if
instance_state
is
not
None
:
instance_state
=
json
.
loads
(
instance_state
)
instance_state
=
json
.
loads
(
instance_state
)
use_for_single_location
=
instance_state
.
get
(
'use_for_single_location'
,
USE_FOR_SINGLE_LOCATION
)
else
:
else
:
instance_state
=
{}
instance_state
=
{}
#We need to set the location here so the child modules can use it
#We need to set the location here so the child modules can use it
system
.
set
(
'location'
,
location
)
system
.
set
(
'location'
,
location
)
log
.
debug
(
"Location: {0}"
.
format
(
location
))
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
)
self
.
use_for_single_location
=
self
.
metadata
.
get
(
'use_for_single_location'
,
use_for_single_location
)
if
isinstance
(
self
.
use_for_single_location
,
basestring
):
if
isinstance
(
self
.
use_for_single_location
,
basestring
):
self
.
use_for_single_location
=
(
self
.
use_for_single_location
in
TRUE_DICT
)
self
.
use_for_single_location
=
(
self
.
use_for_single_location
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
link_to_location_object
=
Location
(
self
.
link_to_location
)
self
.
ajax_url
=
self
.
system
.
ajax_url
self
.
ajax_url
=
self
.
system
.
ajax_url
if
not
self
.
ajax_url
.
endswith
(
"/"
):
if
not
self
.
ajax_url
.
endswith
(
"/"
):
self
.
ajax_url
=
self
.
ajax_url
+
"/"
self
.
ajax_url
=
self
.
ajax_url
+
"/"
...
@@ -99,15 +106,13 @@ class PeerGradingModule(XModule):
...
@@ -99,15 +106,13 @@ class PeerGradingModule(XModule):
if
not
self
.
use_for_single_location
:
if
not
self
.
use_for_single_location
:
return
self
.
peer_grading
()
return
self
.
peer_grading
()
else
:
else
:
return
self
.
peer_grading_problem
({
'location'
:
self
.
system
.
location
})
return
self
.
peer_grading_problem
({
'location'
:
self
.
link_to_
location
})
def
handle_ajax
(
self
,
dispatch
,
get
):
def
handle_ajax
(
self
,
dispatch
,
get
):
"""
"""
Needs to be implemented by child modules. Handles AJAX events.
Needs to be implemented by child modules. Handles AJAX events.
@return:
@return:
"""
"""
log
.
debug
(
get
)
handlers
=
{
handlers
=
{
'get_next_submission'
:
self
.
get_next_submission
,
'get_next_submission'
:
self
.
get_next_submission
,
'show_calibration_essay'
:
self
.
show_calibration_essay
,
'show_calibration_essay'
:
self
.
show_calibration_essay
,
...
...
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