Major change: I have added finance_history
* pulled old values of data via restic backups
* inserted them into a new finance_history table
* added a finplan user, use of sudo & better ENV (container/production) & wrapper.sh into Dockerfile (like I do for other projects)
* recalculate the bills / Living Expenses now we have real bills for a year
* remove tax back for now (need to handle quit date vs. end of financial year better)
* hard-coded / hacked in 2026 for pay cycle dates / should be dynamic, but not sure I'll work in 2027+
* refactor front-end to handle 2026 as the current year / its more or less dynamic (via hard-coded FIRST_YEAR) variable - could not use datetime, as it was in late Dec. when I noticed the issue ('next pay' was in 2026, current year was 2025)
* also added history to graphs, changed formatting to make the history /
* savings projections to be orannge with circles, but historical is a solid line, future is a dash, also made all lines have lineWidth: 1 for aesthetics
This commit is contained in:
10
main.py
10
main.py
@@ -1,7 +1,7 @@
|
||||
# main.py
|
||||
from flask import Flask, render_template, request, redirect, url_for, Response, jsonify
|
||||
from calc import calculate_savings_depletion, calc_key_dates
|
||||
from db import init_db, get_finance_data, update_finance, get_budget_data
|
||||
from db import init_db, get_historical_data, get_finance_data, update_finance, get_budget_data
|
||||
from db import insert_cset, get_comp_set_data, get_comp_set_options, delete_cset
|
||||
from db import get_bill_freqs, get_bill_growth_types
|
||||
from db import get_bill_data, new_bill, update_bill_data, delete_bill, delete_estimated_bills, delete_estimated_bills_for
|
||||
@@ -26,6 +26,7 @@ init_db()
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
hist = get_historical_data()
|
||||
finance_data = get_finance_data()
|
||||
get_comp_set_options(finance_data)
|
||||
bill_data = get_bill_data("order_by_date_only")
|
||||
@@ -106,7 +107,7 @@ def index():
|
||||
# now work out how much padding we need in the first year to align the last dates for all years
|
||||
padding=second_count - first_count
|
||||
key_dates = calc_key_dates( finance_data )
|
||||
return render_template('index.html', now=now, first_yr=first_yr, padding=padding, finance=finance_data, depletion_date=depletion_date, savings=savings_per_fortnight, BUDGET=BUDGET, COMP=COMP, DISP=DISP, key_dates=key_dates)
|
||||
return render_template('index.html', now=now, first_yr=first_yr, padding=padding, finance=finance_data, depletion_date=depletion_date, savings=savings_per_fortnight, BUDGET=BUDGET, COMP=COMP, DISP=DISP, key_dates=key_dates, hist=hist)
|
||||
|
||||
@app.route('/save', methods=['POST'])
|
||||
def save():
|
||||
@@ -185,7 +186,10 @@ def DisplayBillData():
|
||||
total=calc_future_totals(bill_info, bill_types)
|
||||
# update/re-get bill_data now that new estimated bills have been added
|
||||
bill_data = get_bill_data("order_by_bill_type_then_date")
|
||||
return render_template('bills.html', bill_data=bill_data, bill_types=bill_types, bill_freqs=bill_freqs, bill_ui=bill_ui, this_year=datetime.today().year, END_YEAR=END_YEAR, total=total, key_dates=key_dates, growth=bill_growth_types, cpi=finance_data['Inflation'] )
|
||||
finance_data = get_finance_data()
|
||||
# FIXME: really need to do this better, but for now, hard code til I quit seems okay to me
|
||||
FIRST_YEAR=2026
|
||||
return render_template('bills.html', bill_data=bill_data, bill_types=bill_types, bill_freqs=bill_freqs, bill_ui=bill_ui, this_year=datetime.today().year, FIRST_YEAR=FIRST_YEAR, END_YEAR=END_YEAR, total=total, key_dates=key_dates, growth=bill_growth_types, cpi=finance_data['Inflation'] )
|
||||
|
||||
@app.route('/newbilltype', methods=['POST'])
|
||||
def InsertBillType():
|
||||
|
||||
Reference in New Issue
Block a user