Commit 1a0055ae by Renzo Lucioni

Blank common and advanced problems now display an inline score of '0 points' upon creation.

parent a569a5f6
...@@ -146,7 +146,7 @@ class Progress(object): ...@@ -146,7 +146,7 @@ class Progress(object):
sending Progress objects to js to limit dependencies. sending Progress objects to js to limit dependencies.
''' '''
if progress is None: if progress is None:
return "NA" return "0"
return progress.ternary_str() return progress.ternary_str()
@staticmethod @staticmethod
...@@ -157,5 +157,5 @@ class Progress(object): ...@@ -157,5 +157,5 @@ class Progress(object):
passing Progress objects to js to limit dependencies. passing Progress objects to js to limit dependencies.
''' '''
if progress is None: if progress is None:
return "NA" return "0"
return str(progress) return str(progress)
...@@ -90,15 +90,15 @@ class ProgressTest(unittest.TestCase): ...@@ -90,15 +90,15 @@ class ProgressTest(unittest.TestCase):
self.assertEqual(Progress.to_js_status_str(self.not_started), "none") self.assertEqual(Progress.to_js_status_str(self.not_started), "none")
self.assertEqual(Progress.to_js_status_str(self.half_done), "in_progress") self.assertEqual(Progress.to_js_status_str(self.half_done), "in_progress")
self.assertEqual(Progress.to_js_status_str(self.done), "done") self.assertEqual(Progress.to_js_status_str(self.done), "done")
self.assertEqual(Progress.to_js_status_str(None), "NA") self.assertEqual(Progress.to_js_status_str(None), "0")
def test_to_js_detail_str(self): def test_to_js_detail_str(self):
'''Test the Progress.to_js_detail_str() method''' '''Test the Progress.to_js_detail_str() method'''
f = Progress.to_js_detail_str f = Progress.to_js_detail_str
for p in (self.not_started, self.half_done, self.done): for p in (self.not_started, self.half_done, self.done):
self.assertEqual(f(p), str(p)) self.assertEqual(f(p), str(p))
# But None should be encoded as NA # But None should be encoded as 0
self.assertEqual(f(None), "NA") self.assertEqual(f(None), "0")
def test_add(self): def test_add(self):
'''Test the Progress.add_counts() method''' '''Test the Progress.add_counts() method'''
......
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