Commit f4f2efc3 by kimth

Merge pull request #636 from MITx/feature/cale/progress-handle-extra-credit

Feature/cale/progress handle extra credit
parents a1b3b6ba 5ce516a3
...@@ -202,10 +202,8 @@ class CapaModule(XModule): ...@@ -202,10 +202,8 @@ class CapaModule(XModule):
try: try:
return Progress(score, total) return Progress(score, total)
except Exception as err: except Exception as err:
# TODO (vshnayder): why is this still here? still needed? log.exception("Got bad progress")
if self.system.DEBUG: return None
return None
raise
return None return None
def get_html(self): def get_html(self):
......
...@@ -39,9 +39,14 @@ class Progress(object): ...@@ -39,9 +39,14 @@ class Progress(object):
isinstance(b, numbers.Number)): isinstance(b, numbers.Number)):
raise TypeError('a and b must be numbers. Passed {0}/{1}'.format(a, b)) raise TypeError('a and b must be numbers. Passed {0}/{1}'.format(a, b))
if not (0 <= a <= b and b > 0): if a > b:
raise ValueError( a = b
'fraction a/b = {0}/{1} must have 0 <= a <= b and b > 0'.format(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._a = a
self._b = b self._b = b
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment