make radio button for min / avg / max growth value be pushed into which_growth in the DB for bill_type row, then also delete estimated bills for that bill_type, and then calling /bills, causes the estimated bills to be filled back in based on the new chosen growth model

This commit is contained in:
2025-08-21 18:20:32 +10:00
parent ada6dfa3f5
commit 3521d4c126
4 changed files with 47 additions and 8 deletions

10
db.py
View File

@@ -278,6 +278,16 @@ def get_bill_types():
conn.close()
return bt
def use_growth( bill_type, which_growth ):
conn = connect_db(False)
cur = conn.cursor()
cur.execute( f"update bill_type set which_growth = '{which_growth}' where id = {bill_type}" )
# okay, new growth type being used, delete old estimated bills are recreate them
cur.execute( f"delete from bill_data where estimated=1 and bill_type = {bill_type}" )
conn.commit()
conn.close()
return
def get_bill_freqs():
conn = connect_db(True)
cur = conn.cursor()