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
4c5e59e8
Commit
4c5e59e8
authored
Feb 04, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start to fix up instance states
parent
ed282c05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletions
+38
-1
common/lib/xmodule/xmodule/peer_grading_module.py
+32
-1
common/lib/xmodule/xmodule/peer_grading_service.py
+6
-0
No files found.
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
4c5e59e8
...
@@ -40,6 +40,7 @@ log = logging.getLogger(__name__)
...
@@ -40,6 +40,7 @@ log = logging.getLogger(__name__)
USE_FOR_SINGLE_LOCATION
=
False
USE_FOR_SINGLE_LOCATION
=
False
LINK_TO_LOCATION
=
""
LINK_TO_LOCATION
=
""
TRUE_DICT
=
[
True
,
"True"
,
"true"
,
"TRUE"
]
TRUE_DICT
=
[
True
,
"True"
,
"true"
,
"TRUE"
]
MAX_SCORE
=
1
class
PeerGradingModule
(
XModule
):
class
PeerGradingModule
(
XModule
):
...
@@ -62,7 +63,6 @@ class PeerGradingModule(XModule):
...
@@ -62,7 +63,6 @@ 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
=
{}
...
@@ -84,6 +84,12 @@ class PeerGradingModule(XModule):
...
@@ -84,6 +84,12 @@ class PeerGradingModule(XModule):
if
not
self
.
ajax_url
.
endswith
(
"/"
):
if
not
self
.
ajax_url
.
endswith
(
"/"
):
self
.
ajax_url
=
self
.
ajax_url
+
"/"
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_score'
,
MAX_SCORE
)
if
not
isinstance
(
self
.
max_score
,
(
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_score
)
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.
...
@@ -135,6 +141,18 @@ class PeerGradingModule(XModule):
...
@@ -135,6 +141,18 @@ class PeerGradingModule(XModule):
def
get_score
(
self
):
def
get_score
(
self
):
pass
pass
def
max_score
(
self
):
''' Maximum score. Two notes:
* This is generic; in abstract, a problem could be 3/5 points on one
randomization, and 5/7 on another
'''
max_score
=
None
if
self
.
check_if_done_and_scored
():
last_response
=
self
.
get_last_response
(
self
.
current_task_number
)
max_score
=
last_response
[
'max_score'
]
return
max_score
def
get_next_submission
(
self
,
get
):
def
get_next_submission
(
self
,
get
):
"""
"""
Makes a call to the grading controller for the next essay that should be graded
Makes a call to the grading controller for the next essay that should be graded
...
@@ -399,6 +417,19 @@ class PeerGradingModule(XModule):
...
@@ -399,6 +417,19 @@ class PeerGradingModule(XModule):
return
{
'html'
:
html
,
'success'
:
True
}
return
{
'html'
:
html
,
'success'
:
True
}
def
get_instance_state
(
self
):
"""
Returns the current instance state. The module can be recreated from the instance state.
Input: None
Output: A dictionary containing the instance state.
"""
state
=
{
'student_data_for_location'
:
self
.
student_data_for_location
,
}
return
json
.
dumps
(
state
)
class
PeerGradingDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
class
PeerGradingDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
"""
"""
Module for adding combined open ended questions
Module for adding combined open ended questions
...
...
common/lib/xmodule/xmodule/peer_grading_service.py
View file @
4c5e59e8
...
@@ -32,8 +32,14 @@ class PeerGradingService():
...
@@ -32,8 +32,14 @@ class PeerGradingService():
self
.
save_calibration_essay_url
=
self
.
url
+
'/save_calibration_essay/'
self
.
save_calibration_essay_url
=
self
.
url
+
'/save_calibration_essay/'
self
.
get_problem_list_url
=
self
.
url
+
'/get_problem_list/'
self
.
get_problem_list_url
=
self
.
url
+
'/get_problem_list/'
self
.
get_notifications_url
=
self
.
url
+
'/get_notifications/'
self
.
get_notifications_url
=
self
.
url
+
'/get_notifications/'
self
.
get_data_for_location_url
=
self
.
url
+
'/get_data_for_location/'
self
.
system
=
system
self
.
system
=
system
def
get_data_for_location
(
self
,
problem_location
,
student_id
):
response
=
self
.
get
(
self
.
get_data_for_location_url
,
{
'location'
:
problem_location
,
'student_id'
:
student_id
})
return
self
.
_render_rubric
(
response
)
def
get_next_submission
(
self
,
problem_location
,
grader_id
):
def
get_next_submission
(
self
,
problem_location
,
grader_id
):
response
=
self
.
get
(
self
.
get_next_submission_url
,
response
=
self
.
get
(
self
.
get_next_submission_url
,
{
'location'
:
problem_location
,
'grader_id'
:
grader_id
})
{
'location'
:
problem_location
,
'grader_id'
:
grader_id
})
...
...
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