Commit b62e13ae by Bridger Maxwell

Using new xmodule API in grades.py.

parent 234fb813
......@@ -178,6 +178,7 @@ class CourseDescriptor(SequenceDescriptor):
for s in c.get_children():
if s.metadata.get('graded', False):
xmoduledescriptors = list(yield_descriptor_descendents(s))
xmoduledescriptors.append(s)
# The xmoduledescriptors included here are only the ones that have scores.
section_description = { 'section_descriptor' : s, 'xmoduledescriptors' : filter(lambda child: child.has_score, xmoduledescriptors) }
......
......@@ -35,15 +35,15 @@ def yield_dynamic_descriptor_descendents(descriptor, module_creator):
"""
def get_dynamic_descriptor_children(descriptor):
if descriptor.has_dynamic_children():
print "descriptor has dynamic children" , descriptor.location
module = module_creator(descriptor)
children_locations = module.get_children_locations()
child_locations = module.get_children_locations()
return [descriptor.system.load_item(child_location) for child_location in child_locations ]
else:
return descriptor.get_children()
stack = get_dynamic_descriptor_children(descriptor)
stack.reverse()
stack = [descriptor]
while len(stack) > 0:
next_descriptor = stack.pop()
......@@ -289,12 +289,11 @@ def progress_summary(student, request, course, grader, student_module_cache):
graded = section_module.metadata.get('graded', False)
scores = []
module_locations = section_module.definition.get('children', [])
for module_location in module_locations:
module_descriptor = course.system.load_item(module_location)
module_creator = lambda descriptor : section_module.system.get_module(descriptor.location)
for module_descriptor in yield_dynamic_descriptor_descendents(section_module.descriptor, module_creator):
course_id = course.id
module_creator = lambda decriptor : section_module.system.get_module(descriptor.location)
(correct, total) = get_score(course_id, student, module_descriptor, module_creator, student_module_cache)
if correct is None and total is None:
continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment