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:
2
TODO
2
TODO
@@ -3,8 +3,6 @@ CALC:
|
||||
differently, but hard to calc - slides around with tax brackets in future
|
||||
|
||||
UI:
|
||||
* have a comparison management capability - somehow, at least be able to delete csets (can I put an x inside the menu? OR, have a manage button and pop-up?)
|
||||
|
||||
* maybe a help/note/set of links somehow, to common things: e.g. macquarie int rate page, inflation source, etc.
|
||||
- also then could effectively take those "notes" out of db.py and incorporate, so that when I update stuff it gets done right
|
||||
- in fact, I *COULD* have a basic date check/workflow, e.g. its been more than X days since Y was updated, click here
|
||||
|
||||
8
db.py
8
db.py
@@ -404,3 +404,11 @@ def delete_estimated_bills():
|
||||
conn.commit()
|
||||
conn.close()
|
||||
return
|
||||
|
||||
def delete_cset(id):
|
||||
conn = connect_db(False)
|
||||
cur = conn.cursor()
|
||||
cur.execute( f"delete from comparison_set where id = '{id}'" )
|
||||
conn.commit()
|
||||
conn.close()
|
||||
return
|
||||
|
||||
28
main.py
28
main.py
@@ -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)
|
||||
|
||||
@@ -475,4 +475,3 @@
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<h3 align="center">Finance Tracker (go to <a href="bills">Bills</a>)</h3>
|
||||
<h3 align="center">Finance Tracker (go to <a href="bills">Bills</a> or <a href="cset">Comparison Sets</a>)</h3>
|
||||
|
||||
<form id="vals_form" class="ms-3 mt-3" action="/update" method="POST">
|
||||
{% for r in DISP %}
|
||||
@@ -389,4 +389,3 @@
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user