From e78e71634e83f7e7b82f3ce70858a8f7eae4c00a Mon Sep 17 00:00:00 2001 From: Jasper Berghoef Date: Fri, 25 Aug 2017 11:33:14 +0200 Subject: [PATCH] Fix hit percentage --- src/wagtail_personalisation/rules.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wagtail_personalisation/rules.py b/src/wagtail_personalisation/rules.py index eb0ced0..e30f589 100644 --- a/src/wagtail_personalisation/rules.py +++ b/src/wagtail_personalisation/rules.py @@ -64,9 +64,9 @@ class AbstractBaseRule(models.Model): @property def hit_percentage(self): - percentage = Decimal( + percentage = round(Decimal( (self.hit_count / self.visit_count) * 100 - ).quantize(Decimal('.01')) + ), 2) return '%d' % percentage @property