Skip to content

Commit

Permalink
Merge pull request #39 from faanskit/fix-for-issue-#38
Browse files Browse the repository at this point in the history
fix for issue #38 division by zero
  • Loading branch information
faanskit authored Jun 17, 2024
2 parents 3653ee2 + ad18fe7 commit e996051
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pycheckwatt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ async def get_fcrd_month_net_revenue(self):
misseddays += 1
dayswithmoney = int(dayssofar) - int(misseddays)
if response.status == 200:
self.dailyaverage = self.revenuemonth / int(dayswithmoney)
if dayswithmoney > 0:
self.dailyaverage = self.revenuemonth / int(dayswithmoney)
else:
self.dailyaverage = 0
self.monthestimate = (
self.dailyaverage * daysleft
) + self.revenuemonth
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pycheckwatt"
version = "0.2.6"
version = "0.2.7"
description = "Read data from CheckWatts EnergyInBalance WEB API"
authors = ["Marcus Karlsson <[email protected]>", "Anders Yderborg <[email protected]>", "Daniel Nilsson <[email protected]>"]
license = "MIT License"
Expand Down

0 comments on commit e996051

Please sign in to comment.