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

This commit is contained in:
Renzo Lucioni
2013-07-24 16:44:22 -04:00
parent a569a5f6a7
commit 1a0055ae77
2 changed files with 5 additions and 5 deletions

View File

@@ -146,7 +146,7 @@ class Progress(object):
sending Progress objects to js to limit dependencies.
'''
if progress is None:
return "NA"
return "0"
return progress.ternary_str()
@staticmethod
@@ -157,5 +157,5 @@ class Progress(object):
passing Progress objects to js to limit dependencies.
'''
if progress is None:
return "NA"
return "0"
return str(progress)

View File

@@ -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.half_done), "in_progress")
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):
'''Test the Progress.to_js_detail_str() method'''
f = Progress.to_js_detail_str
for p in (self.not_started, self.half_done, self.done):
self.assertEqual(f(p), str(p))
# But None should be encoded as NA
self.assertEqual(f(None), "NA")
# But None should be encoded as 0
self.assertEqual(f(None), "0")
def test_add(self):
'''Test the Progress.add_counts() method'''