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
35551049
Commit
35551049
authored
Mar 05, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature/vik/fix-oe-storage' into feature/alex/poll-merged
parents
b7680f31
cb4a7c66
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
114 additions
and
115 deletions
+114
-115
common/lib/capa/setup.py
+1
-1
common/lib/xmodule/xmodule/combined_open_ended_module.py
+30
-23
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
+14
-18
common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py
+5
-2
common/lib/xmodule/xmodule/open_ended_grading_classes/self_assessment_module.py
+4
-1
common/lib/xmodule/xmodule/peer_grading_module.py
+17
-62
lms/djangoapps/open_ended_grading/open_ended_notifications.py
+16
-2
lms/djangoapps/open_ended_grading/staff_grading_service.py
+8
-1
lms/djangoapps/open_ended_grading/tests.py
+11
-4
lms/djangoapps/open_ended_grading/views.py
+8
-1
No files found.
common/lib/capa/setup.py
View file @
35551049
...
@@ -4,5 +4,5 @@ setup(
...
@@ -4,5 +4,5 @@ setup(
name
=
"capa"
,
name
=
"capa"
,
version
=
"0.1"
,
version
=
"0.1"
,
packages
=
find_packages
(
exclude
=
[
"tests"
]),
packages
=
find_packages
(
exclude
=
[
"tests"
]),
install_requires
=
[
'distribute==0.6.3
4
'
,
'pyparsing==1.5.6'
],
install_requires
=
[
'distribute==0.6.3
0
'
,
'pyparsing==1.5.6'
],
)
)
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
35551049
...
@@ -6,13 +6,18 @@ from pkg_resources import resource_string
...
@@ -6,13 +6,18 @@ from pkg_resources import resource_string
from
xmodule.raw_module
import
RawDescriptor
from
xmodule.raw_module
import
RawDescriptor
from
.x_module
import
XModule
from
.x_module
import
XModule
from
xblock.core
import
Integer
,
Scope
,
BlockScope
,
ModelType
,
String
,
Boolean
,
Object
,
Float
from
xmodule.open_ended_grading_classes.combined_open_ended_modulev1
import
CombinedOpenEndedV1Module
,
CombinedOpenEndedV1Descriptor
from
xmodule.open_ended_grading_classes.combined_open_ended_modulev1
import
CombinedOpenEndedV1Module
,
CombinedOpenEndedV1Descriptor
log
=
logging
.
getLogger
(
"mitx.courseware"
)
log
=
logging
.
getLogger
(
"mitx.courseware"
)
V1_ATTRIBUTES
=
[
"display_name"
,
"current_task_number"
,
"task_states"
,
"state"
,
"attempts"
,
"ready_to_reset"
,
"max_attempts"
,
"is_graded"
,
"accept_file_upload"
,
"skip_spelling_checks"
,
"due"
,
"graceperiod"
,
"max_score"
,
"data"
]
VERSION_TUPLES
=
(
VERSION_TUPLES
=
(
(
'1'
,
CombinedOpenEndedV1Descriptor
,
CombinedOpenEndedV1Module
),
(
'1'
,
CombinedOpenEndedV1Descriptor
,
CombinedOpenEndedV1Module
,
V1_ATTRIBUTES
),
)
)
DEFAULT_VERSION
=
1
DEFAULT_VERSION
=
1
...
@@ -49,6 +54,24 @@ class CombinedOpenEndedModule(XModule):
...
@@ -49,6 +54,24 @@ class CombinedOpenEndedModule(XModule):
INTERMEDIATE_DONE
=
'intermediate_done'
INTERMEDIATE_DONE
=
'intermediate_done'
DONE
=
'done'
DONE
=
'done'
icon_class
=
'problem'
display_name
=
String
(
help
=
"Display name for this module"
,
scope
=
Scope
.
settings
)
current_task_number
=
Integer
(
help
=
"Current task that the student is on."
,
default
=
0
,
scope
=
Scope
.
student_state
)
task_states
=
String
(
help
=
"State dictionaries of each task within this module."
,
default
=
json
.
dumps
(
"[]"
),
scope
=
Scope
.
student_state
)
state
=
String
(
help
=
"Which step within the current task that the student is on."
,
default
=
"initial"
,
scope
=
Scope
.
student_state
)
attempts
=
Integer
(
help
=
"Number of attempts taken by the student on this problem"
,
default
=
0
,
scope
=
Scope
.
student_state
)
ready_to_reset
=
Boolean
(
help
=
"If the problem is ready to be reset or not."
,
default
=
False
,
scope
=
Scope
.
student_state
)
max_attempts
=
Integer
(
help
=
"Maximum number of attempts that a student is allowed."
,
default
=
1
,
scope
=
Scope
.
settings
)
is_graded
=
Boolean
(
help
=
"Whether or not the problem is graded."
,
default
=
False
,
scope
=
Scope
.
settings
)
accept_file_upload
=
Boolean
(
help
=
"Whether or not the problem accepts file uploads."
,
default
=
False
,
scope
=
Scope
.
settings
)
skip_spelling_checks
=
Boolean
(
help
=
"Whether or not to skip initial spelling checks."
,
default
=
True
,
scope
=
Scope
.
settings
)
due
=
String
(
help
=
"Date that this problem is due by"
,
default
=
None
,
scope
=
Scope
.
settings
)
graceperiod
=
String
(
help
=
"Amount of time after the due date that submissions will be accepted"
,
default
=
None
,
scope
=
Scope
.
settings
)
max_score
=
Integer
(
help
=
"Maximum score for the problem."
,
default
=
1
,
scope
=
Scope
.
settings
)
version
=
Integer
(
help
=
"Current version number"
,
default
=
DEFAULT_VERSION
,
scope
=
Scope
.
settings
)
data
=
String
(
help
=
"XML data for the problem"
,
scope
=
Scope
.
content
)
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/combinedopenended/display.coffee'
),
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/combinedopenended/display.coffee'
),
resource_string
(
__name__
,
'js/src/collapsible.coffee'
),
resource_string
(
__name__
,
'js/src/collapsible.coffee'
),
resource_string
(
__name__
,
'js/src/javascript_loader.coffee'
),
resource_string
(
__name__
,
'js/src/javascript_loader.coffee'
),
...
@@ -57,10 +80,8 @@ class CombinedOpenEndedModule(XModule):
...
@@ -57,10 +80,8 @@ class CombinedOpenEndedModule(XModule):
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/combinedopenended/display.scss'
)]}
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/combinedopenended/display.scss'
)]}
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
def
__init__
(
self
,
system
,
location
,
descriptor
,
model_data
):
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
XModule
.
__init__
(
self
,
system
,
location
,
descriptor
,
model_data
)
XModule
.
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
instance_state
,
shared_state
,
**
kwargs
)
"""
"""
Definition file should have one or many task blocks, a rubric block, and a prompt block:
Definition file should have one or many task blocks, a rubric block, and a prompt block:
...
@@ -100,25 +121,10 @@ class CombinedOpenEndedModule(XModule):
...
@@ -100,25 +121,10 @@ class CombinedOpenEndedModule(XModule):
self
.
system
=
system
self
.
system
=
system
self
.
system
.
set
(
'location'
,
location
)
self
.
system
.
set
(
'location'
,
location
)
# Load instance state
if
instance_state
is
not
None
:
instance_state
=
json
.
loads
(
instance_state
)
else
:
instance_state
=
{}
self
.
version
=
self
.
metadata
.
get
(
'version'
,
DEFAULT_VERSION
)
version_error_string
=
"Version of combined open ended module {0} is not correct. Going with version {1}"
if
not
isinstance
(
self
.
version
,
basestring
):
try
:
self
.
version
=
str
(
self
.
version
)
except
:
#This is a dev_facing_error
log
.
info
(
version_error_string
.
format
(
self
.
version
,
DEFAULT_VERSION
))
self
.
version
=
DEFAULT_VERSION
versions
=
[
i
[
0
]
for
i
in
VERSION_TUPLES
]
versions
=
[
i
[
0
]
for
i
in
VERSION_TUPLES
]
descriptors
=
[
i
[
1
]
for
i
in
VERSION_TUPLES
]
descriptors
=
[
i
[
1
]
for
i
in
VERSION_TUPLES
]
modules
=
[
i
[
2
]
for
i
in
VERSION_TUPLES
]
modules
=
[
i
[
2
]
for
i
in
VERSION_TUPLES
]
attributes
=
[
i
[
3
]
for
i
in
VERSION_TUPLES
]
try
:
try
:
version_index
=
versions
.
index
(
self
.
version
)
version_index
=
versions
.
index
(
self
.
version
)
...
@@ -132,10 +138,11 @@ class CombinedOpenEndedModule(XModule):
...
@@ -132,10 +138,11 @@ class CombinedOpenEndedModule(XModule):
'rewrite_content_links'
:
self
.
rewrite_content_links
,
'rewrite_content_links'
:
self
.
rewrite_content_links
,
}
}
instance_state
=
{
k
:
self
.
__dict__
[
k
]
for
k
in
self
.
__dict__
if
k
in
attributes
[
version_index
]}
self
.
child_descriptor
=
descriptors
[
version_index
](
self
.
system
)
self
.
child_descriptor
=
descriptors
[
version_index
](
self
.
system
)
self
.
child_definition
=
descriptors
[
version_index
]
.
definition_from_xml
(
etree
.
fromstring
(
definition
[
'data'
]
),
self
.
system
)
self
.
child_definition
=
descriptors
[
version_index
]
.
definition_from_xml
(
etree
.
fromstring
(
self
.
data
),
self
.
system
)
self
.
child_module
=
modules
[
version_index
](
self
.
system
,
location
,
self
.
child_definition
,
self
.
child_descriptor
,
self
.
child_module
=
modules
[
version_index
](
self
.
system
,
location
,
self
.
child_definition
,
self
.
child_descriptor
,
instance_state
=
json
.
dumps
(
instance_state
),
metadata
=
self
.
metadata
,
static_data
=
static_data
)
instance_state
=
instance_state
,
static_data
=
static_data
)
def
get_html
(
self
):
def
get_html
(
self
):
return
self
.
child_module
.
get_html
()
return
self
.
child_module
.
get_html
()
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
View file @
35551049
...
@@ -115,17 +115,10 @@ class CombinedOpenEndedV1Module():
...
@@ -115,17 +115,10 @@ class CombinedOpenEndedV1Module():
"""
"""
self
.
metadata
=
metadata
self
.
instance_state
=
instance_state
self
.
display_name
=
metadata
.
get
(
'display_name'
,
"Open Ended"
)
self
.
display_name
=
instance_state
.
get
(
'display_name'
,
"Open Ended"
)
self
.
rewrite_content_links
=
static_data
.
get
(
'rewrite_content_links'
,
""
)
self
.
rewrite_content_links
=
static_data
.
get
(
'rewrite_content_links'
,
""
)
# Load instance state
if
instance_state
is
not
None
:
instance_state
=
json
.
loads
(
instance_state
)
else
:
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
)
self
.
system
=
system
self
.
system
=
system
...
@@ -141,14 +134,14 @@ class CombinedOpenEndedV1Module():
...
@@ -141,14 +134,14 @@ class CombinedOpenEndedV1Module():
#Allow reset is true if student has failed the criteria to move to the next child task
#Allow reset is true if student has failed the criteria to move to the next child task
self
.
allow_reset
=
instance_state
.
get
(
'ready_to_reset'
,
False
)
self
.
allow_reset
=
instance_state
.
get
(
'ready_to_reset'
,
False
)
self
.
max_attempts
=
int
(
self
.
metadata
.
get
(
'attempts'
,
MAX_ATTEMPTS
))
self
.
max_attempts
=
int
(
self
.
instance_state
.
get
(
'attempts'
,
MAX_ATTEMPTS
))
self
.
is_scored
=
self
.
metadata
.
get
(
'is_graded'
,
IS_SCORED
)
in
TRUE_DICT
self
.
is_scored
=
self
.
instance_state
.
get
(
'is_graded'
,
IS_SCORED
)
in
TRUE_DICT
self
.
accept_file_upload
=
self
.
metadata
.
get
(
'accept_file_upload'
,
ACCEPT_FILE_UPLOAD
)
in
TRUE_DICT
self
.
accept_file_upload
=
self
.
instance_state
.
get
(
'accept_file_upload'
,
ACCEPT_FILE_UPLOAD
)
in
TRUE_DICT
self
.
skip_basic_checks
=
self
.
metadata
.
get
(
'skip_spelling_checks'
,
SKIP_BASIC_CHECKS
)
self
.
skip_basic_checks
=
self
.
instance_state
.
get
(
'skip_spelling_checks'
,
SKIP_BASIC_CHECKS
)
display_due_date_string
=
self
.
metadata
.
get
(
'due'
,
None
)
display_due_date_string
=
self
.
instance_state
.
get
(
'due'
,
None
)
grace_period_string
=
self
.
metadata
.
get
(
'graceperiod'
,
None
)
grace_period_string
=
self
.
instance_state
.
get
(
'graceperiod'
,
None
)
try
:
try
:
self
.
timeinfo
=
TimeInfo
(
display_due_date_string
,
grace_period_string
)
self
.
timeinfo
=
TimeInfo
(
display_due_date_string
,
grace_period_string
)
except
:
except
:
...
@@ -158,7 +151,7 @@ class CombinedOpenEndedV1Module():
...
@@ -158,7 +151,7 @@ class CombinedOpenEndedV1Module():
# Used for progress / grading. Currently get credit just for
# Used for progress / grading. Currently get credit just for
# completion (doesn't matter if you self-assessed correct/incorrect).
# completion (doesn't matter if you self-assessed correct/incorrect).
self
.
_max_score
=
int
(
self
.
metadata
.
get
(
'max_score'
,
MAX_SCORE
))
self
.
_max_score
=
int
(
self
.
instance_state
.
get
(
'max_score'
,
MAX_SCORE
))
self
.
rubric_renderer
=
CombinedOpenEndedRubric
(
system
,
True
)
self
.
rubric_renderer
=
CombinedOpenEndedRubric
(
system
,
True
)
rubric_string
=
stringify_children
(
definition
[
'rubric'
])
rubric_string
=
stringify_children
(
definition
[
'rubric'
])
...
@@ -760,7 +753,7 @@ class CombinedOpenEndedV1Module():
...
@@ -760,7 +753,7 @@ class CombinedOpenEndedV1Module():
return
progress_object
return
progress_object
class
CombinedOpenEndedV1Descriptor
(
XmlDescriptor
,
EditingDescriptor
):
class
CombinedOpenEndedV1Descriptor
():
"""
"""
Module for adding combined open ended questions
Module for adding combined open ended questions
"""
"""
...
@@ -772,6 +765,9 @@ class CombinedOpenEndedV1Descriptor(XmlDescriptor, EditingDescriptor):
...
@@ -772,6 +765,9 @@ class CombinedOpenEndedV1Descriptor(XmlDescriptor, EditingDescriptor):
has_score
=
True
has_score
=
True
template_dir_name
=
"combinedopenended"
template_dir_name
=
"combinedopenended"
def
__init__
(
self
,
system
):
self
.
system
=
system
@classmethod
@classmethod
def
definition_from_xml
(
cls
,
xml_object
,
system
):
def
definition_from_xml
(
cls
,
xml_object
,
system
):
"""
"""
...
@@ -798,7 +794,7 @@ class CombinedOpenEndedV1Descriptor(XmlDescriptor, EditingDescriptor):
...
@@ -798,7 +794,7 @@ class CombinedOpenEndedV1Descriptor(XmlDescriptor, EditingDescriptor):
"""Assumes that xml_object has child k"""
"""Assumes that xml_object has child k"""
return
xml_object
.
xpath
(
k
)[
0
]
return
xml_object
.
xpath
(
k
)[
0
]
return
{
'task_xml'
:
parse_task
(
'task'
),
'prompt'
:
parse
(
'prompt'
),
'rubric'
:
parse
(
'rubric'
)}
,
[]
return
{
'task_xml'
:
parse_task
(
'task'
),
'prompt'
:
parse
(
'prompt'
),
'rubric'
:
parse
(
'rubric'
)}
def
definition_to_xml
(
self
,
resource_fs
):
def
definition_to_xml
(
self
,
resource_fs
):
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py
View file @
35551049
...
@@ -696,7 +696,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
...
@@ -696,7 +696,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
return
html
return
html
class
OpenEndedDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
class
OpenEndedDescriptor
():
"""
"""
Module for adding open ended response questions to courses
Module for adding open ended response questions to courses
"""
"""
...
@@ -708,6 +708,9 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
...
@@ -708,6 +708,9 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
has_score
=
True
has_score
=
True
template_dir_name
=
"openended"
template_dir_name
=
"openended"
def
__init__
(
self
,
system
):
self
.
system
=
system
@classmethod
@classmethod
def
definition_from_xml
(
cls
,
xml_object
,
system
):
def
definition_from_xml
(
cls
,
xml_object
,
system
):
"""
"""
...
@@ -727,7 +730,7 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
...
@@ -727,7 +730,7 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
"""Assumes that xml_object has child k"""
"""Assumes that xml_object has child k"""
return
xml_object
.
xpath
(
k
)[
0
]
return
xml_object
.
xpath
(
k
)[
0
]
return
{
'oeparam'
:
parse
(
'openendedparam'
)}
,
[]
return
{
'oeparam'
:
parse
(
'openendedparam'
)}
def
definition_to_xml
(
self
,
resource_fs
):
def
definition_to_xml
(
self
,
resource_fs
):
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/self_assessment_module.py
View file @
35551049
...
@@ -299,7 +299,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
...
@@ -299,7 +299,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
return
[
rubric_scores
]
return
[
rubric_scores
]
class
SelfAssessmentDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
class
SelfAssessmentDescriptor
():
"""
"""
Module for adding self assessment questions to courses
Module for adding self assessment questions to courses
"""
"""
...
@@ -311,6 +311,9 @@ class SelfAssessmentDescriptor(XmlDescriptor, EditingDescriptor):
...
@@ -311,6 +311,9 @@ class SelfAssessmentDescriptor(XmlDescriptor, EditingDescriptor):
has_score
=
True
has_score
=
True
template_dir_name
=
"selfassessment"
template_dir_name
=
"selfassessment"
def
__init__
(
self
,
system
):
self
.
system
=
system
@classmethod
@classmethod
def
definition_from_xml
(
cls
,
xml_object
,
system
):
def
definition_from_xml
(
cls
,
xml_object
,
system
):
"""
"""
...
...
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
35551049
...
@@ -6,10 +6,9 @@ from lxml import etree
...
@@ -6,10 +6,9 @@ from lxml import etree
from
datetime
import
datetime
from
datetime
import
datetime
from
pkg_resources
import
resource_string
from
pkg_resources
import
resource_string
from
.capa_module
import
ComplexEncoder
from
.capa_module
import
ComplexEncoder
from
.editing_module
import
EditingDescriptor
from
.stringify
import
stringify_children
from
.stringify
import
stringify_children
from
.x_module
import
XModule
from
.x_module
import
XModule
from
.xml_module
import
Xml
Descriptor
from
xmodule.raw_module
import
Raw
Descriptor
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
timeinfo
import
TimeInfo
from
timeinfo
import
TimeInfo
...
@@ -40,14 +39,16 @@ class PeerGradingModule(XModule):
...
@@ -40,14 +39,16 @@ class PeerGradingModule(XModule):
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/combinedopenended/display.scss'
)]}
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/combinedopenended/display.scss'
)]}
student_data_for_location
=
Object
(
scope
=
Scope
.
student_state
)
use_for_single_location
=
Boolean
(
help
=
"Whether to use this for a single location or as a panel."
,
default
=
USE_FOR_SINGLE_LOCATION
,
scope
=
Scope
.
settings
)
max_grade
=
Integer
(
default
=
MAX_SCORE
,
scope
=
Scope
.
student_state
)
link_to_location
=
String
(
help
=
"The location this problem is linked to."
,
default
=
LINK_TO_LOCATION
,
scope
=
Scope
.
settings
)
use_for_single_location
=
Boolean
(
default
=
USE_FOR_SINGLE_LOCATION
,
scope
=
Scope
.
settings
)
is_graded
=
Boolean
(
help
=
"Whether or not this module is scored."
,
default
=
IS_GRADED
,
scope
=
Scope
.
settings
)
is_graded
=
Boolean
(
default
=
IS_GRADED
,
scope
=
Scope
.
settings
)
display_due_date_string
=
String
(
help
=
"Due date that should be displayed."
,
default
=
None
,
scope
=
Scope
.
settings
)
link_to_location
=
String
(
default
=
LINK_TO_LOCATION
,
scope
=
Scope
.
settings
)
grace_period_string
=
String
(
help
=
"Amount of grace to give on the due date."
,
default
=
None
,
scope
=
Scope
.
settings
)
max_grade
=
Integer
(
help
=
"The maximum grade that a student can receieve for this problem."
,
default
=
MAX_SCORE
,
scope
=
Scope
.
settings
)
student_data_for_location
=
Object
(
help
=
"Student data for a given peer grading problem."
,
default
=
json
.
dumps
({}),
scope
=
Scope
.
student_state
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
system
,
location
,
descriptor
,
model_data
):
super
(
PeerGradingModule
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
XModule
.
__init__
(
self
,
system
,
location
,
descriptor
,
model_data
)
#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
)
...
@@ -57,11 +58,6 @@ class PeerGradingModule(XModule):
...
@@ -57,11 +58,6 @@ class PeerGradingModule(XModule):
else
:
else
:
self
.
peer_gs
=
MockPeerGradingService
()
self
.
peer_gs
=
MockPeerGradingService
()
if
isinstance
(
self
.
use_for_single_location
,
basestring
):
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
:
if
self
.
use_for_single_location
==
True
:
try
:
try
:
self
.
linked_problem
=
modulestore
()
.
get_instance
(
self
.
system
.
course_id
,
self
.
link_to_location
)
self
.
linked_problem
=
modulestore
()
.
get_instance
(
self
.
system
.
course_id
,
self
.
link_to_location
)
...
@@ -73,21 +69,18 @@ class PeerGradingModule(XModule):
...
@@ -73,21 +69,18 @@ class PeerGradingModule(XModule):
if
due_date
:
if
due_date
:
self
.
metadata
[
'due'
]
=
due_date
self
.
metadata
[
'due'
]
=
due_date
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
)
display_due_date_string
=
self
.
metadata
.
get
(
'due'
,
None
)
grace_period_string
=
self
.
metadata
.
get
(
'graceperiod'
,
None
)
try
:
try
:
self
.
timeinfo
=
TimeInfo
(
display_due_date_string
,
grace_period_string
)
self
.
timeinfo
=
TimeInfo
(
self
.
display_due_date_string
,
self
.
grace_period_string
)
except
:
except
:
log
.
error
(
"Error parsing due date information in location {0}"
.
format
(
location
))
log
.
error
(
"Error parsing due date information in location {0}"
.
format
(
location
))
raise
raise
self
.
display_due_date
=
self
.
timeinfo
.
display_due_date
self
.
display_due_date
=
self
.
timeinfo
.
display_due_date
try
:
self
.
student_data_for_location
=
json
.
loads
(
self
.
student_data_for_location
)
except
:
pass
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
(
"/"
):
...
@@ -558,9 +551,9 @@ class PeerGradingModule(XModule):
...
@@ -558,9 +551,9 @@ class PeerGradingModule(XModule):
return
json
.
dumps
(
state
)
return
json
.
dumps
(
state
)
class
PeerGradingDescriptor
(
XmlDescriptor
,
Editing
Descriptor
):
class
PeerGradingDescriptor
(
Raw
Descriptor
):
"""
"""
Module for adding
combined open ended
questions
Module for adding
peer grading
questions
"""
"""
mako_template
=
"widgets/raw-edit.html"
mako_template
=
"widgets/raw-edit.html"
module_class
=
PeerGradingModule
module_class
=
PeerGradingModule
...
@@ -569,41 +562,3 @@ class PeerGradingDescriptor(XmlDescriptor, EditingDescriptor):
...
@@ -569,41 +562,3 @@ class PeerGradingDescriptor(XmlDescriptor, EditingDescriptor):
stores_state
=
True
stores_state
=
True
has_score
=
True
has_score
=
True
template_dir_name
=
"peer_grading"
template_dir_name
=
"peer_grading"
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/html/edit.coffee'
)]}
js_module_name
=
"HTMLEditingDescriptor"
@classmethod
def
definition_from_xml
(
cls
,
xml_object
,
system
):
"""
Pull out the individual tasks, the rubric, and the prompt, and parse
Returns:
{
'rubric': 'some-html',
'prompt': 'some-html',
'task_xml': dictionary of xml strings,
}
"""
log
.
debug
(
"In definition"
)
expected_children
=
[]
for
child
in
expected_children
:
if
len
(
xml_object
.
xpath
(
child
))
==
0
:
#This is a staff_facing_error
raise
ValueError
(
"Peer grading definition must include at least one '{0}' tag. Contact the learning sciences group for assistance."
.
format
(
child
))
def
parse_task
(
k
):
"""Assumes that xml_object has child k"""
return
[
stringify_children
(
xml_object
.
xpath
(
k
)[
i
])
for
i
in
xrange
(
0
,
len
(
xml_object
.
xpath
(
k
)))]
def
parse
(
k
):
"""Assumes that xml_object has child k"""
return
xml_object
.
xpath
(
k
)[
0
]
return
{},
[]
def
definition_to_xml
(
self
,
resource_fs
):
'''Return an xml element representing this definition.'''
elt
=
etree
.
Element
(
'peergrading'
)
return
elt
lms/djangoapps/open_ended_grading/open_ended_notifications.py
View file @
35551049
...
@@ -59,7 +59,14 @@ def staff_grading_notifications(course, user):
...
@@ -59,7 +59,14 @@ def staff_grading_notifications(course, user):
def
peer_grading_notifications
(
course
,
user
):
def
peer_grading_notifications
(
course
,
user
):
system
=
ModuleSystem
(
None
,
None
,
None
,
render_to_string
,
None
)
system
=
ModuleSystem
(
ajax_url
=
None
,
track_function
=
None
,
get_module
=
None
,
render_template
=
render_to_string
,
replace_urls
=
None
,
xblock_model_data
=
{}
)
peer_gs
=
peer_grading_service
.
PeerGradingService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
,
system
)
peer_gs
=
peer_grading_service
.
PeerGradingService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
,
system
)
pending_grading
=
False
pending_grading
=
False
img_path
=
""
img_path
=
""
...
@@ -93,7 +100,14 @@ def peer_grading_notifications(course, user):
...
@@ -93,7 +100,14 @@ def peer_grading_notifications(course, user):
def
combined_notifications
(
course
,
user
):
def
combined_notifications
(
course
,
user
):
system
=
ModuleSystem
(
None
,
None
,
None
,
render_to_string
,
None
)
system
=
ModuleSystem
(
ajax_url
=
None
,
track_function
=
None
,
get_module
=
None
,
render_template
=
render_to_string
,
replace_urls
=
None
,
xblock_model_data
=
{}
)
controller_qs
=
ControllerQueryService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
,
system
)
controller_qs
=
ControllerQueryService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
,
system
)
student_id
=
unique_id_for_user
(
user
)
student_id
=
unique_id_for_user
(
user
)
user_is_staff
=
has_access
(
user
,
course
,
'staff'
)
user_is_staff
=
has_access
(
user
,
course
,
'staff'
)
...
...
lms/djangoapps/open_ended_grading/staff_grading_service.py
View file @
35551049
...
@@ -60,7 +60,14 @@ class StaffGradingService(GradingService):
...
@@ -60,7 +60,14 @@ class StaffGradingService(GradingService):
Interface to staff grading backend.
Interface to staff grading backend.
"""
"""
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
config
[
'system'
]
=
ModuleSystem
(
None
,
None
,
None
,
render_to_string
,
None
)
config
[
'system'
]
=
ModuleSystem
(
ajax_url
=
None
,
track_function
=
None
,
get_module
=
None
,
render_template
=
render_to_string
,
replace_urls
=
None
,
xblock_model_data
=
{}
)
super
(
StaffGradingService
,
self
)
.
__init__
(
config
)
super
(
StaffGradingService
,
self
)
.
__init__
(
config
)
self
.
url
=
config
[
'url'
]
+
config
[
'staff_grading'
]
self
.
url
=
config
[
'url'
]
+
config
[
'staff_grading'
]
self
.
login_url
=
self
.
url
+
'/login/'
self
.
login_url
=
self
.
url
+
'/login/'
...
...
lms/djangoapps/open_ended_grading/tests.py
View file @
35551049
...
@@ -145,14 +145,21 @@ class TestPeerGradingService(ct.PageLoader):
...
@@ -145,14 +145,21 @@ class TestPeerGradingService(ct.PageLoader):
self
.
course_id
=
"edX/toy/2012_Fall"
self
.
course_id
=
"edX/toy/2012_Fall"
self
.
toy
=
modulestore
()
.
get_course
(
self
.
course_id
)
self
.
toy
=
modulestore
()
.
get_course
(
self
.
course_id
)
location
=
"i4x://edX/toy/peergrading/init"
location
=
"i4x://edX/toy/peergrading/init"
model_data
=
{
'data'
:
"<peergrading/>"
}
self
.
mock_service
=
peer_grading_service
.
MockPeerGradingService
()
self
.
mock_service
=
peer_grading_service
.
MockPeerGradingService
()
self
.
system
=
ModuleSystem
(
location
,
None
,
None
,
render_to_string
,
None
,
self
.
system
=
ModuleSystem
(
ajax_url
=
location
,
track_function
=
None
,
get_module
=
None
,
render_template
=
render_to_string
,
replace_urls
=
None
,
xblock_model_data
=
{},
s3_interface
=
test_util_open_ended
.
S3_INTERFACE
,
s3_interface
=
test_util_open_ended
.
S3_INTERFACE
,
open_ended_grading_interface
=
test_util_open_ended
.
OPEN_ENDED_GRADING_INTERFACE
open_ended_grading_interface
=
test_util_open_ended
.
OPEN_ENDED_GRADING_INTERFACE
)
)
self
.
descriptor
=
peer_grading_module
.
PeerGradingDescriptor
(
self
.
system
)
self
.
descriptor
=
peer_grading_module
.
PeerGradingDescriptor
(
self
.
system
,
location
,
model_data
)
self
.
peer_module
=
peer_grading_module
.
PeerGradingModule
(
self
.
system
,
location
,
"<peergrading/>"
,
self
.
descriptor
)
model_data
=
{}
self
.
peer_module
=
peer_grading_module
.
PeerGradingModule
(
self
.
system
,
location
,
self
.
descriptor
,
model_data
)
self
.
peer_module
.
peer_gs
=
self
.
mock_service
self
.
peer_module
.
peer_gs
=
self
.
mock_service
self
.
logout
()
self
.
logout
()
...
...
lms/djangoapps/open_ended_grading/views.py
View file @
35551049
...
@@ -29,7 +29,14 @@ log = logging.getLogger(__name__)
...
@@ -29,7 +29,14 @@ log = logging.getLogger(__name__)
template_imports
=
{
'urllib'
:
urllib
}
template_imports
=
{
'urllib'
:
urllib
}
system
=
ModuleSystem
(
None
,
None
,
None
,
render_to_string
,
None
,
None
)
system
=
ModuleSystem
(
ajax_url
=
None
,
track_function
=
None
,
get_module
=
None
,
render_template
=
render_to_string
,
replace_urls
=
None
,
xblock_model_data
=
{}
)
controller_qs
=
ControllerQueryService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
,
system
)
controller_qs
=
ControllerQueryService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
,
system
)
"""
"""
...
...
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