From 28a33c85b7e5cfbdd74c0d4d5533c6adc7c426e8 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Sat, 13 Apr 2013 14:59:45 +0200 Subject: [PATCH] Use float precision to compute the quota usage. see #391 --- modoboa/admin/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modoboa/admin/models.py b/modoboa/admin/models.py index 682e0d36b..6deebe21c 100644 --- a/modoboa/admin/models.py +++ b/modoboa/admin/models.py @@ -728,7 +728,7 @@ class Mailbox(DatesAware): if not self.quota: return 0 q = Quota.objects.get(username=self.full_address) - return q.bytes / (self.quota * 1048576) * 100 + return int(q.bytes / float(self.quota * 1048576) * 100) def save_from_user(self, localpart, domain, user, quota=None, owner=None): """Simple save method called for automatic creations