added ability to delete comparison sets, also made future bills recalc for Hydunday/D_quit dependent future bills, this is not effectively functional -v1.0 :)

This commit is contained in:
2025-11-04 11:36:36 +11:00
parent 9cc907fb62
commit 0a9a50f9a1
5 changed files with 138 additions and 25 deletions

10
main.py
View File

@@ -5,7 +5,7 @@ from db import init_db, get_finance_data, update_finance, get_budget_data, inser
from db import get_bill_data, new_bill, update_bill_data, delete_bill, delete_estimated_bills
from db import get_bill_ui, save_ui, delete_cset
from db import get_bill_types, insert_bill_type, update_bill_type, delete_bill_type, use_growth
from bills import process_bill_data, calc_future_totals, set_bill_type_growth
from bills import process_bill_data, calc_future_totals, set_bill_type_growth, recalcFutureBills
from defines import END_YEAR
from collections import defaultdict, Counter
from datetime import datetime, date
@@ -113,6 +113,8 @@ def save():
@app.route('/update', methods=['POST'])
def update():
old_finance_data = get_finance_data()
finance_data = (
request.form['D_Salary'],
request.form['D_Num_fortnights_pay'],
@@ -142,7 +144,11 @@ def update():
request.form['Ioniq6_future']
)
update_finance(finance_data)
# FIXME: need code here to delete/rebuild future bills if we change "D # Pays to quit "
new_finance_data = get_finance_data()
# changed Ioniq6_future, Car_buyout_date or D_Num_fortnights_pay, so lets force recalc key_dates, and therefore estimated bills
if old_finance_data['D_Num_fortnights_pay'] != new_finance_data['D_Num_fortnights_pay'] or old_finance_data['Ioniq6_future'] != new_finance_data['Ioniq6_future'] or old_finance_data['Car_buyout_date'] != new_finance_data['Car_buyout_date']:
recalcFutureBills()
return redirect(url_for('index'))
@app.route('/bills')