From 60781b8a49c5b3ef39621b6d0252fdf8c7dbc33b Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Mon, 13 Aug 2012 14:21:19 -0400 Subject: [PATCH] Address comments on #394 --- common/lib/xmodule/xmodule/x_module.py | 4 ++-- lms/djangoapps/courseware/grades.py | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 9f99f5a526ed..071e4539010e 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -227,7 +227,7 @@ def get_children(self): def get_display_items(self): ''' Returns a list of descendent module instances that will display - immediately inside this module + immediately inside this module. ''' items = [] for child in self.get_children(): @@ -238,7 +238,7 @@ def get_display_items(self): def displayable_items(self): ''' Returns list of displayable modules contained by this module. If this - module is visible, should return [self] + module is visible, should return [self]. ''' return [self] diff --git a/lms/djangoapps/courseware/grades.py b/lms/djangoapps/courseware/grades.py index 85f883d2f07e..aa160ee22aa1 100644 --- a/lms/djangoapps/courseware/grades.py +++ b/lms/djangoapps/courseware/grades.py @@ -145,15 +145,11 @@ def progress_summary(student, course, grader, student_module_cache): instance_modules for the student """ chapters = [] - for c in course.get_children(): - # Don't include chapters that aren't displayable (e.g. due to error) - if c not in c.displayable_items(): - continue + # Don't include chapters that aren't displayable (e.g. due to error) + for c in course.get_display_items(): sections = [] - for s in c.get_children(): + for s in c.get_display_items(): # Same for sections - if s not in s.displayable_items(): - continue graded = s.metadata.get('graded', False) scores = [] for module in yield_module_descendents(s):