diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 2cf8226662..d186bcc39c 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -202,10 +202,8 @@ class CapaModule(XModule): try: return Progress(score, total) except Exception as err: - # TODO (vshnayder): why is this still here? still needed? - if self.system.DEBUG: - return None - raise + log.exception("Got bad progress") + return None return None def get_html(self): diff --git a/common/lib/xmodule/xmodule/progress.py b/common/lib/xmodule/xmodule/progress.py index 70c8ec9da1..7adbb02646 100644 --- a/common/lib/xmodule/xmodule/progress.py +++ b/common/lib/xmodule/xmodule/progress.py @@ -39,9 +39,14 @@ class Progress(object): isinstance(b, numbers.Number)): raise TypeError('a and b must be numbers. Passed {0}/{1}'.format(a, b)) - if not (0 <= a <= b and b > 0): - raise ValueError( - 'fraction a/b = {0}/{1} must have 0 <= a <= b and b > 0'.format(a, b)) + if a > b: + a = b + + if a < 0: + a = 0 + + if b <= 0: + raise ValueError('fraction a/b = {0}/{1} must have b > 0'.format(a, b)) self._a = a self._b = b