added a basic comparison set page, with a table of the data that changes only (just to fit it in) and allowing them to be deleted

This commit is contained in:
2025-11-01 22:48:21 +11:00
parent 4bb336645a
commit 9cc907fb62
5 changed files with 36 additions and 6 deletions

28
main.py
View File

@@ -3,7 +3,7 @@ from flask import Flask, render_template, request, redirect, url_for, Response,
from calc import calculate_savings_depletion, calc_key_dates
from db import init_db, get_finance_data, update_finance, get_budget_data, insert_cset, get_comp_set_data, get_comp_set_options, get_bill_freqs
from db import get_bill_data, new_bill, update_bill_data, delete_bill, delete_estimated_bills
from db import get_bill_ui, save_ui
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 defines import END_YEAR
@@ -220,6 +220,32 @@ def force_recalc_bills():
delete_estimated_bills()
return "200"
@app.route('/cset')
def cset():
finance_data = get_finance_data()
get_comp_set_options(finance_data)
comp_data={}
for el in finance_data['COMP_SETS']:
comp_data[el[0]] = get_comp_set_data( el[0] )
# delete items not that helpful (same for all, not that interesting)
if el[0]:
del comp_data[el[0]]['vars']['Car_loan_via_pay']
del comp_data[el[0]]['vars']['Mark_reno']
del comp_data[el[0]]['vars']['Mark_reno_date']
del comp_data[el[0]]['vars']['Overseas_trip_date']
del comp_data[el[0]]['vars']['Car_balloon']
del comp_data[el[0]]['vars']['Mich_present']
del comp_data[el[0]]['vars']['D_TLS_shares']
del comp_data[el[0]]['vars']['M_TLS_shares']
return render_template('cset.html', finance=finance_data, comp_data=comp_data )
@app.route('/delcset', methods=['POST'])
def DeleteCSet():
data = request.get_json()
delete_cset( data['id'] )
return "200"
# Main program
if __name__ == '__main__':
app.run(debug=True)