Make grade graph on profile work correctly

This commit is contained in:
Calen Pennington
2012-06-28 13:40:37 -04:00
parent 23195e9d76
commit 35af8101d7
4 changed files with 18 additions and 7 deletions

View File

@@ -57,8 +57,6 @@ class SemanticSectionDescriptor(XModuleDescriptor):
if len(xml_object) == 1:
for (key, val) in xml_object.items():
if key == 'format':
continue
xml_object[0].set(key, val)
return system.process_xml(etree.tostring(xml_object[0]))

View File

@@ -85,6 +85,8 @@ class XModule(object):
self.display_name = kwargs.get('display_name', '')
self.type = self.location.category
self._loaded_children = None
self.graded = kwargs.get('graded', False)
self.format = kwargs.get('format')
def get_name(self):
name = self.__xmltree.get('name')
@@ -281,6 +283,9 @@ class XModuleDescriptor(Plugin):
Current arguments passed in kwargs:
location: A keystore.Location object indicating the name and ownership of this problem
goals: A list of strings of learning goals associated with this module
display_name: The name to use for displaying this module to the user
format: The format of this module ('Homework', 'Lab', etc)
graded (bool): Whether this module is should be graded or not
"""
self.system = system
self.definition = definition if definition is not None else {}
@@ -288,6 +293,8 @@ class XModuleDescriptor(Plugin):
self.type = Location(kwargs.get('location')).category
self.url = Location(kwargs.get('location')).url()
self.display_name = kwargs.get('display_name')
self.format = kwargs.get('format')
self.graded = kwargs.get('graded', False)
# For now, we represent goals as a list of strings, but this
# is one of the things that we are going to be iterating on heavily
@@ -315,7 +322,9 @@ class XModuleDescriptor(Plugin):
instance_state and shared_state, and returns a fully nstantiated XModule
"""
return partial(self.module_class, system, self.url, self.definition,
display_name=self.display_name)
display_name=self.display_name,
format=self.format,
graded=self.graded)
class DescriptorSystem(object):
def __init__(self, load_item, resources_fs):

View File

@@ -37,5 +37,7 @@ class XmlDescriptor(XModuleDescriptor):
course,
xml_object.tag,
xml_object.get('slug')],
display_name=xml_object.get('name')
display_name=xml_object.get('name'),
format=xml_object.get('format'),
graded=xml_object.get('graded') == 'true',
)