From ee561a5127814fe7a79924b23cdb080b9d2cc849 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sat, 22 Jul 2023 21:56:53 +0200 Subject: [PATCH] Fix division by zero --- docs/changelog.rst | 2 ++ gnuviechadmin/hostingpackages/models.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 07ccf87..574ae0d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,8 @@ Changelog ========= +* :bug:`-` fix division by zero for hosting packages without disk space allocation + * :release:`0.14.1 <2023-07-22>` * :bug:`-` fix squashed migration for disk space statistics diff --git a/gnuviechadmin/hostingpackages/models.py b/gnuviechadmin/hostingpackages/models.py index 0f2a111..5565a2f 100644 --- a/gnuviechadmin/hostingpackages/models.py +++ b/gnuviechadmin/hostingpackages/models.py @@ -290,6 +290,8 @@ class CustomerHostingPackage(HostingPackageBase): used_disk_space_sum = property(get_used_disk_space_sum) def get_space_level(self): + if not self.diskspace: + return 100.0 return self.used_disk_space_sum / self.disk_space * 100.0 space_level = property(get_space_level)