bug: fix some calcuation errors with pool info

This commit is contained in:
Upstream Data
2024-10-30 14:08:22 -06:00
parent b098cb8136
commit 05a8569205

View File

@@ -89,6 +89,8 @@ class PoolMetrics:
@staticmethod
def _calculate_percentage(value: int, total: int) -> float:
"""Calculate the percentage."""
if value is None or total is None:
return 0
if total == 0:
return 0
return (value / total) * 100