bug: fix some calcuation errors with pool info
This commit is contained in:
@@ -89,6 +89,8 @@ class PoolMetrics:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _calculate_percentage(value: int, total: int) -> float:
|
def _calculate_percentage(value: int, total: int) -> float:
|
||||||
"""Calculate the percentage."""
|
"""Calculate the percentage."""
|
||||||
|
if value is None or total is None:
|
||||||
|
return 0
|
||||||
if total == 0:
|
if total == 0:
|
||||||
return 0
|
return 0
|
||||||
return (value / total) * 100
|
return (value / total) * 100
|
||||||
|
|||||||
Reference in New Issue
Block a user