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):
|
for module_descriptor in yield_descriptor_descendents(child):
|
||||||
yield module_descriptor
|
yield module_descriptor
|
||||||
|
|
||||||
for c in self.get_children():
|
for chapter in self.get_children():
|
||||||
for s in c.get_children():
|
for section in chapter.get_children():
|
||||||
if s.graded:
|
if section.graded:
|
||||||
xmoduledescriptors = list(yield_descriptor_descendents(s))
|
xmoduledescriptors = list(yield_descriptor_descendents(section))
|
||||||
xmoduledescriptors.append(s)
|
xmoduledescriptors.append(section)
|
||||||
|
|
||||||
# The xmoduledescriptors included here are only the ones that have scores.
|
# The xmoduledescriptors included here are only the ones that have scores.
|
||||||
section_description = {
|
section_description = {
|
||||||
'section_descriptor': s,
|
'section_descriptor': section,
|
||||||
'xmoduledescriptors': filter(lambda child: child.has_score, xmoduledescriptors)
|
'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]
|
graded_sections[section_format] = graded_sections.get(section_format, []) + [section_description]
|
||||||
|
|
||||||
all_descriptors.extend(xmoduledescriptors)
|
all_descriptors.extend(xmoduledescriptors)
|
||||||
all_descriptors.append(s)
|
all_descriptors.append(section)
|
||||||
|
|
||||||
return {'graded_sections': graded_sections,
|
return {'graded_sections': graded_sections,
|
||||||
'all_descriptors': all_descriptors, }
|
'all_descriptors': all_descriptors, }
|
||||||
|
|||||||
Reference in New Issue
Block a user