From 4ba26a3a1ab2b67a96dc47f8e6660d1c845c6ea3 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 22 Apr 2013 08:04:16 -0400 Subject: [PATCH] Only render a histogram for modules that have scores associated with them --- common/djangoapps/xmodule_modifiers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/djangoapps/xmodule_modifiers.py b/common/djangoapps/xmodule_modifiers.py index 3f6db354d6..45691cd854 100644 --- a/common/djangoapps/xmodule_modifiers.py +++ b/common/djangoapps/xmodule_modifiers.py @@ -105,8 +105,12 @@ def add_histogram(get_html, module, user): return get_html() module_id = module.id - histogram = grade_histogram(module_id) - render_histogram = len(histogram) > 0 + if module.descriptor.has_score: + histogram = grade_histogram(module_id) + render_histogram = len(histogram) > 0 + else: + histogram = None + render_histogram = False if settings.MITX_FEATURES.get('ENABLE_LMS_MIGRATION'): [filepath, filename] = getattr(module.descriptor, 'xml_attributes', {}).get('filename', ['', None])