From 7be2093edb2a860027429044dd82b9a12434bcd7 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 5 Oct 2016 16:48:42 -0400 Subject: [PATCH] Break early if max_score is not defined Some XModules are breaking their contracts and defining has_score but not max_score. TNL-5715 --- lms/djangoapps/instructor/enrollment.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/instructor/enrollment.py b/lms/djangoapps/instructor/enrollment.py index fd3921431b..69acebff36 100644 --- a/lms/djangoapps/instructor/enrollment.py +++ b/lms/djangoapps/instructor/enrollment.py @@ -317,7 +317,11 @@ def _fire_score_changed_for_block(course_id, student, block, module_state_key): field_data_cache=cache, course_key=course_id ) - points_earned, points_possible = weighted_score(0, module.max_score(), getattr(module, 'weight', None)) + max_score = module.max_score() + if max_score is None: + return + else: + points_earned, points_possible = weighted_score(0, max_score, getattr(module, 'weight', None)) else: points_earned, points_possible = 0, 0 SCORE_CHANGED.send(