Only render a histogram for modules that have scores associated with them

This commit is contained in:
Calen Pennington
2013-04-22 08:04:16 -04:00
parent 4615f0d869
commit 4ba26a3a1a

View File

@@ -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])