From 59e5be280f0181c47d2da0ed5935db9f6a9635e3 Mon Sep 17 00:00:00 2001 From: UpstreamData Date: Wed, 22 Feb 2023 12:10:53 -0700 Subject: [PATCH] bug: fix a division by 0 error edge case in MinerData. --- pyasic/data/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyasic/data/__init__.py b/pyasic/data/__init__.py index b61d8d54..603c4083 100644 --- a/pyasic/data/__init__.py +++ b/pyasic/data/__init__.py @@ -403,6 +403,8 @@ class MinerData: @property def percent_ideal(self): # noqa - Skip PyCharm inspection + if self.total_chips == 0 or self.ideal_chips == 0: + return 0 return round((self.total_chips / self.ideal_chips) * 100) @percent_ideal.setter