Clarify grading variables in the CourseModule
This commit is contained in:
@@ -1211,23 +1211,23 @@ class CourseDescriptor(CourseFields, SequenceDescriptor):
|
||||
for module_descriptor in yield_descriptor_descendents(child):
|
||||
yield module_descriptor
|
||||
|
||||
for c in self.get_children():
|
||||
for s in c.get_children():
|
||||
if s.graded:
|
||||
xmoduledescriptors = list(yield_descriptor_descendents(s))
|
||||
xmoduledescriptors.append(s)
|
||||
for chapter in self.get_children():
|
||||
for section in chapter.get_children():
|
||||
if section.graded:
|
||||
xmoduledescriptors = list(yield_descriptor_descendents(section))
|
||||
xmoduledescriptors.append(section)
|
||||
|
||||
# The xmoduledescriptors included here are only the ones that have scores.
|
||||
section_description = {
|
||||
'section_descriptor': s,
|
||||
'xmoduledescriptors': filter(lambda child: child.has_score, xmoduledescriptors)
|
||||
'section_descriptor': section,
|
||||
'xmoduledescriptors': [child for child in xmoduledescriptors if child.has_score]
|
||||
}
|
||||
|
||||
section_format = s.format if s.format is not None else ''
|
||||
section_format = section.format if section.format is not None else ''
|
||||
graded_sections[section_format] = graded_sections.get(section_format, []) + [section_description]
|
||||
|
||||
all_descriptors.extend(xmoduledescriptors)
|
||||
all_descriptors.append(s)
|
||||
all_descriptors.append(section)
|
||||
|
||||
return {'graded_sections': graded_sections,
|
||||
'all_descriptors': all_descriptors, }
|
||||
|
||||
Reference in New Issue
Block a user