Address review comments
This commit is contained in:
@@ -906,17 +906,11 @@ class CombinedOpenEndedV1Module():
|
||||
"""
|
||||
|
||||
d = self.get_score()
|
||||
score = d['score']
|
||||
total = d['total']
|
||||
|
||||
if total > 0 and self.is_scored:
|
||||
if self.weight is not None:
|
||||
# scale score and total by weight/total:
|
||||
score = score * self.get_weight() / total
|
||||
total = self.get_weight()
|
||||
if d['total'] > 0 and self.is_scored:
|
||||
|
||||
try:
|
||||
return Progress(score, total)
|
||||
return Progress(d['score'], d['total'])
|
||||
except (TypeError, ValueError):
|
||||
log.exception("Got bad progress")
|
||||
return None
|
||||
|
||||
@@ -498,10 +498,10 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
|
||||
progress = self.combinedoe.get_progress()
|
||||
self.assertIsInstance(progress, Progress)
|
||||
|
||||
#progress._a is the score of the xmodule, which is 0 right now
|
||||
# progress._a is the score of the xmodule, which is 0 right now.
|
||||
self.assertEqual(progress._a, 0)
|
||||
|
||||
#progress._b is the max_score (which is 1), divided by the weight (which is 1)
|
||||
# progress._b is the max_score (which is 1), divided by the weight (which is 1).
|
||||
self.assertEqual(progress._b, 1)
|
||||
|
||||
def test_container_weight(self):
|
||||
|
||||
Reference in New Issue
Block a user