diff --git a/perguntations/testfactory.py b/perguntations/testfactory.py index d9b8217..89f605b 100644 --- a/perguntations/testfactory.py +++ b/perguntations/testfactory.py @@ -62,6 +62,7 @@ test_schema = schema.Schema({ schema.Optional('points'): float }] }, ignore_extra_keys=True) + # FIXME schema error with 'testfile' which is added in the code # ============================================================================ class TestFactoryException(Exception): @@ -315,8 +316,11 @@ class TestFactory(dict): # normalize question points to scale if self['scale'] is not None: scale_min, scale_max = self['scale'] + factor = (scale_max - scale_min) / total_points for question in questions: - question['points'] *= (scale_max - scale_min) / total_points + question['points'] *= factor + logger.debug('Points normalized from %g to [%g, %g]', + total_points, scale_min, scale_max) else: self['scale'] = [0, total_points] else: -- libgit2 0.21.2