From c469f6d2810698c484b0ad0b19542b4ef1790cf3 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Thu, 21 Aug 2025 16:51:57 +1000 Subject: [PATCH] force new bill to restrict the amount to $/c (2 decimal points) --- db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db.py b/db.py index 5bd5319..4208ced 100644 --- a/db.py +++ b/db.py @@ -290,7 +290,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}', '{bill_date}', {estimated} )" ) + cur.execute( f"insert into bill_data ( 'bill_type', 'amount', 'bill_date', 'estimated' ) values ( '{bill_type}', '{amount:.2f}', '{bill_date}', {estimated} )" ) conn.commit() conn.close() return