From 78141d097f0b4334f95ca9ac9686373a4dd187a2 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Fri, 22 Aug 2025 14:07:49 +1000 Subject: [PATCH] amount needs to be cast to a float to be a .2f in new bill --- db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db.py b/db.py index 3388e60..a5b8f85 100644 --- a/db.py +++ b/db.py @@ -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