amount needs to be cast to a float to be a .2f in new bill

This commit is contained in:
2025-08-22 14:07:49 +10:00
parent 0cf3d9897f
commit 78141d097f

2
db.py
View File

@@ -300,7 +300,7 @@ def get_bill_freqs():
def new_bill( bill_type, amount, bill_date, estimated ):
conn = connect_db(False)
cur = conn.cursor()
cur.execute( f"insert into bill_data ( 'bill_type', 'amount', 'bill_date', 'estimated' ) values ( '{bill_type}', '{amount:.2f}', '{bill_date}', {estimated} )" )
cur.execute( f"insert into bill_data ( 'bill_type', 'amount', 'bill_date', 'estimated' ) values ( '{bill_type}', '{float(amount):.2f}', '{bill_date}', {estimated} )" )
conn.commit()
conn.close()
return