Fix division by zero

This commit is contained in:
Jan Dittberner 2023-07-22 21:56:53 +02:00
parent b69ecbfa2d
commit ee561a5127
2 changed files with 4 additions and 0 deletions

View file

@ -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

View file

@ -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)