change to col-auto everywhere, with some more forcing of width maximums to make the page more consistent, redid defaults to incorporate updated per fortnight lease cost, and updated inflation figure/notes/references. Updated default Living expenses to 84000 to match latest view of data, fixed up compare_to to now work, shows a graph of data to compare with, allows drop-down to be compare_to nothing or a saved set, only 1 hand saved for now. Annotations on graph for large changes in savings now work and are legible - had to allow overlap and do some overly complex left/right up/down offsetting to make them all sensible
This commit is contained in:
22
main.py
22
main.py
@@ -1,7 +1,7 @@
|
||||
# main.py
|
||||
from flask import Flask, render_template, request, redirect, url_for, Response
|
||||
from calc import calculate_savings_depletion
|
||||
from db import init_db, get_finance_data, update_finance, get_budget_data, get_comp_set_data
|
||||
from db import init_db, get_finance_data, update_finance, get_budget_data, get_comp_set_data, get_comp_set_options
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
import csv
|
||||
@@ -16,18 +16,15 @@ init_db()
|
||||
@app.route('/')
|
||||
def index():
|
||||
finance_data = get_finance_data()
|
||||
get_comp_set_options(finance_data)
|
||||
depletion_date, savings_per_fortnight, final_savings = calculate_savings_depletion(finance_data)
|
||||
BUDGET=get_budget_data(finance_data)
|
||||
|
||||
if depletion_date:
|
||||
depletion_date=depletion_date.date(); # just show date
|
||||
|
||||
#HARDCODE HACK:
|
||||
finance_data['comp_set']=1
|
||||
|
||||
# we are comparing...
|
||||
if finance_data['comp_set'] >= 1:
|
||||
COMP=get_comp_set_data(finance_data['comp_set'])
|
||||
# if we are comparing...(compare_to will be 0 / None to start with, and then COMP will be None
|
||||
COMP=get_comp_set_data(finance_data['compare_to'])
|
||||
|
||||
DISP=[]
|
||||
# Row 1
|
||||
@@ -36,7 +33,7 @@ def index():
|
||||
r.append( FP_VAR( 'Savings', 'Savings' ) )
|
||||
r.append( FP_VAR( 'Car Loan via Pay', 'Car_loan_via_pay', 'readonly' ) )
|
||||
r.append( FP_VAR( 'Living Expenses', 'Living_Expenses' ) )
|
||||
r.append( FP_VAR( 'Overseas Trip', 'Overseas_trip', 'date', 'col-4', 'Overseas_trip_date' ) )
|
||||
r.append( FP_VAR( 'Overseas Trip', 'Overseas_trip', 'date', 'col-auto', 'Overseas_trip_date' ) )
|
||||
DISP.append(r)
|
||||
|
||||
# Row 2
|
||||
@@ -45,12 +42,12 @@ def index():
|
||||
r.append( FP_VAR( 'Interest Rate', 'Interest_Rate' ) )
|
||||
r.append( FP_VAR( 'Car Loan', 'Car_loan', 'readonly' ) )
|
||||
r.append( FP_VAR( 'Inflation', 'Inflation' ) )
|
||||
r.append( FP_VAR( 'Reno Costs', 'Mark_reno', 'date', 'col-4', 'Mark_reno_date' ) )
|
||||
r.append( FP_VAR( 'Reno Costs', 'Mark_reno', 'date', 'col-auto', 'Mark_reno_date' ) )
|
||||
DISP.append(r)
|
||||
|
||||
# Row 2
|
||||
r=[]
|
||||
r.append( FP_VAR( 'D leave owed (in days)', 'D_leave_owed_in_days' ) )
|
||||
r.append( FP_VAR( 'D # days leave', 'D_leave_owed_in_days' ) )
|
||||
r.append( FP_VAR( 'M TLS amount', 'M_TLS_shares' ) )
|
||||
r.append( FP_VAR( 'Car Balloon', 'Car_balloon', 'readonly' ) )
|
||||
DISP.append(r)
|
||||
@@ -60,7 +57,7 @@ def index():
|
||||
r.append( FP_VAR( 'D CBA amount', 'D_CBA_shares' ) )
|
||||
r.append( FP_VAR( 'D TLS amount', 'D_TLS_shares' ) )
|
||||
r.append( FP_VAR( 'Mich Present', 'Mich_present', 'readonly' ) )
|
||||
r.append( FP_VAR( 'Sell Shares for:', 'Sell_shares', 'select', 'offset-2 col-2' ) )
|
||||
r.append( FP_VAR( 'Sell Shares for:', 'Sell_shares', 'select', 'col-auto' ) )
|
||||
DISP.append(r)
|
||||
|
||||
# Row 4
|
||||
@@ -100,6 +97,7 @@ def update():
|
||||
request.form['Overseas_trip_date'],
|
||||
request.form['Mark_reno_date'],
|
||||
request.form['Sell_shares'],
|
||||
request.form['compare_to']
|
||||
)
|
||||
|
||||
update_finance(finance_data)
|
||||
@@ -110,7 +108,7 @@ def update():
|
||||
def download_csv():
|
||||
|
||||
finance_data = get_finance_data()
|
||||
depletion_date, savings_per_fortnight, final_savings, TLS, CBA = calculate_savings_depletion(finance_data)
|
||||
depletion_date, savings_per_fortnight, final_savings = calculate_savings_depletion(finance_data)
|
||||
BUDGET=get_budget_data(finance_data)
|
||||
|
||||
# Group data by year
|
||||
|
||||
Reference in New Issue
Block a user