commit cadd251509142ae9b2193fc23918be42f3edaf5d
parent 12c0ee36c027ed07915251f9bcd369f08b0cf6f3
Author: lash <dev@holbrook.no>
Date: Sat, 4 Apr 2026 20:14:25 -0600
Prevent float from entering entrydata
Diffstat:
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/dummy/usawa/entry.py b/dummy/usawa/entry.py
@@ -44,6 +44,8 @@ class EntryPart:
:todo: Make typ enum
"""
def __init__(self, unit, typ, account, amount, debit=False):
+ if isinstance(amount, float):
+ raise ValueError('entrydata must pass amount in int including full precision')
self.unit = unit
self.typ = typ
self.account = account
diff --git a/dummy/usawa/ledger.py b/dummy/usawa/ledger.py
@@ -532,14 +532,10 @@ class Ledger(UsawaElement):
def apply_entryparts(self, entry):
for v in entry.debit:
amount = v.amount
- #if v.isdebit:
- # amount *= -1
self.running[v.unit].apply(v.typ, amount)
for v in entry.credit:
amount = v.amount
- #if v.isdebit:
- # amount *= -1
self.running[v.unit].apply(v.typ, amount)
logg.debug('applied entry {} src {} dst {}'.format(entry.serial, entry.debit, entry.credit))