Skip to content

Commit

Permalink
fixed broken addPerSec and mulPerSec
Browse files Browse the repository at this point in the history
  • Loading branch information
nfearnley committed May 20, 2024
1 parent 19f7f27 commit b37f2b8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sizebot/lib/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@ def __init__(self, diff: Diff, time: TV):
self.time = time

@property
def addPerSec(self) -> SV | None:
def addPerSec(self) -> SV:
if self.diff.changetype != "add":
return None
return 0
return SV(self.diff.amount / self.time)

@property
def mulPerSec(self) -> Decimal | None:
def mulPerSec(self) -> Decimal:
if self.diff.changetype != "mul":
return None
return 1
return Decimal(self.diff.amount ** (1 / self.time))

@property
Expand Down Expand Up @@ -260,11 +260,11 @@ def __init__(self, rate: Rate, stop: SV | TV):
self.stop = stop

@property
def addPerSec(self) -> SV | None:
def addPerSec(self) -> SV:
return self.rate.addPerSec

@property
def mulPerSec(self) -> Decimal | None:
def mulPerSec(self) -> Decimal:
return self.rate.mulPerSec

@property
Expand Down

0 comments on commit b37f2b8

Please sign in to comment.