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
f161bdd0
Commit
f161bdd0
authored
Feb 22, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix studio import and export for CombinedOpenEnded and PeerGrading XModules
Also, fix a bug in the peer grading.
parent
dde4fc98
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
52 deletions
+15
-52
common/lib/xmodule/xmodule/combined_open_ended_module.py
+3
-32
common/lib/xmodule/xmodule/peer_grading_module.py
+12
-20
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
f161bdd0
...
@@ -4,7 +4,7 @@ from lxml import etree
...
@@ -4,7 +4,7 @@ from lxml import etree
from
pkg_resources
import
resource_string
from
pkg_resources
import
resource_string
from
.editing_module
import
Editing
Descriptor
from
xmodule.raw_module
import
Raw
Descriptor
from
.x_module
import
XModule
from
.x_module
import
XModule
from
.xml_module
import
XmlDescriptor
from
.xml_module
import
XmlDescriptor
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
...
@@ -134,7 +134,7 @@ class CombinedOpenEndedModule(XModule):
...
@@ -134,7 +134,7 @@ class CombinedOpenEndedModule(XModule):
}
}
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
[
'
xml_string
'
]),
self
.
system
)
self
.
child_definition
=
descriptors
[
version_index
]
.
definition_from_xml
(
etree
.
fromstring
(
definition
[
'
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
=
json
.
dumps
(
instance_state
),
metadata
=
self
.
metadata
,
static_data
=
static_data
)
...
@@ -165,7 +165,7 @@ class CombinedOpenEndedModule(XModule):
...
@@ -165,7 +165,7 @@ class CombinedOpenEndedModule(XModule):
return
self
.
child_module
.
display_name
return
self
.
child_module
.
display_name
class
CombinedOpenEndedDescriptor
(
XmlDescriptor
,
Editing
Descriptor
):
class
CombinedOpenEndedDescriptor
(
Raw
Descriptor
):
"""
"""
Module for adding combined open ended questions
Module for adding combined open ended questions
"""
"""
...
@@ -180,32 +180,3 @@ class CombinedOpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
...
@@ -180,32 +180,3 @@ class CombinedOpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/html/edit.coffee'
)]}
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/html/edit.coffee'
)]}
js_module_name
=
"HTMLEditingDescriptor"
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,
}
"""
return
{
'xml_string'
:
etree
.
tostring
(
xml_object
),
'metadata'
:
xml_object
.
attrib
}
def
definition_to_xml
(
self
,
resource_fs
):
'''Return an xml element representing this definition.'''
elt
=
etree
.
Element
(
'combinedopenended'
)
def
add_child
(
k
):
child_str
=
'<{tag}>{body}</{tag}>'
.
format
(
tag
=
k
,
body
=
self
.
definition
[
k
])
child_node
=
etree
.
fromstring
(
child_str
)
elt
.
append
(
child_node
)
for
child
in
[
'task'
]:
add_child
(
child
)
return
elt
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
f161bdd0
...
@@ -60,6 +60,18 @@ class PeerGradingModule(XModule):
...
@@ -60,6 +60,18 @@ class PeerGradingModule(XModule):
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
:
try
:
self
.
linked_problem
=
modulestore
()
.
get_instance
(
self
.
system
.
course_id
,
self
.
link_to_location
)
except
:
log
.
error
(
"Linked location {0} for peer grading module {1} does not exist"
.
format
(
self
.
link_to_location
,
self
.
location
))
raise
due_date
=
self
.
linked_problem
.
metadata
.
get
(
'peer_grading_due'
,
None
)
if
due_date
:
self
.
metadata
[
'due'
]
=
due_date
self
.
is_graded
=
self
.
metadata
.
get
(
'is_graded'
,
IS_GRADED
)
self
.
is_graded
=
self
.
metadata
.
get
(
'is_graded'
,
IS_GRADED
)
if
isinstance
(
self
.
is_graded
,
basestring
):
if
isinstance
(
self
.
is_graded
,
basestring
):
self
.
is_graded
=
(
self
.
is_graded
in
TRUE_DICT
)
self
.
is_graded
=
(
self
.
is_graded
in
TRUE_DICT
)
...
@@ -75,17 +87,6 @@ class PeerGradingModule(XModule):
...
@@ -75,17 +87,6 @@ class PeerGradingModule(XModule):
self
.
display_due_date
=
self
.
timeinfo
.
display_due_date
self
.
display_due_date
=
self
.
timeinfo
.
display_due_date
self
.
link_to_location
=
self
.
metadata
.
get
(
'link_to_location'
,
USE_FOR_SINGLE_LOCATION
)
if
self
.
use_for_single_location
==
True
:
try
:
self
.
linked_problem
=
modulestore
()
.
get_instance
(
self
.
system
.
course_id
,
self
.
link_to_location
)
except
:
log
.
error
(
"Linked location {0} for peer grading module {1} does not exist"
.
format
(
self
.
link_to_location
,
self
.
location
))
raise
due_date
=
self
.
linked_problem
.
metadata
.
get
(
'peer_grading_due'
,
None
)
if
due_date
:
self
.
metadata
[
'due'
]
=
due_date
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
(
"/"
):
...
@@ -606,13 +607,4 @@ class PeerGradingDescriptor(XmlDescriptor, EditingDescriptor):
...
@@ -606,13 +607,4 @@ class PeerGradingDescriptor(XmlDescriptor, EditingDescriptor):
def
definition_to_xml
(
self
,
resource_fs
):
def
definition_to_xml
(
self
,
resource_fs
):
'''Return an xml element representing this definition.'''
'''Return an xml element representing this definition.'''
elt
=
etree
.
Element
(
'peergrading'
)
elt
=
etree
.
Element
(
'peergrading'
)
def
add_child
(
k
):
child_str
=
'<{tag}>{body}</{tag}>'
.
format
(
tag
=
k
,
body
=
self
.
definition
[
k
])
child_node
=
etree
.
fromstring
(
child_str
)
elt
.
append
(
child_node
)
for
child
in
[
'task'
]:
add_child
(
child
)
return
elt
return
elt
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