From 51392b566bfd1e290c132f4f270e4f9af9dffc88 Mon Sep 17 00:00:00 2001 From: Miguel BarĂ£o Date: Sun, 19 Jun 2022 22:48:30 +0100 Subject: [PATCH] minor refactor in testfactory.py --- perguntations/testfactory.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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