Compare commits
5 Commits
8446f59740
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 71606035fd | |||
| b8c1edc084 | |||
| f0fee15548 | |||
| 20239d72c8 | |||
| e3d2d8ea08 |
9
BUGS
9
BUGS
@@ -1,12 +1,3 @@
|
||||
* when I delete a comp_set && it is the current compare_to, then need to reset compare_to to 'Nothing'
|
||||
|
||||
* with future bills - recalculate bills button blows away growth!
|
||||
- BUT, I think just loading the bills page puts it back -- need to validate and fix if so
|
||||
|
||||
* with new vertical lay-out, the autosetting of the bill_type when I click add
|
||||
bill no longer sets to the tab I am viewing
|
||||
-- also keeps going back to Gas for some reason?
|
||||
|
||||
* can put in dumb dates - DO SOME INPUT VALIDATION, *sigh*
|
||||
- e.g. 0026-02-19 for a Gas bill
|
||||
|
||||
|
||||
5
bills.py
5
bills.py
@@ -643,8 +643,7 @@ def recalcFutureBills():
|
||||
for fb in future_car_bills:
|
||||
amt=fb['amount']
|
||||
bt=fb['bill_type']
|
||||
# only can use simple growth as its a future bill
|
||||
growth=bill_types[bt]['ann_growth_simple']
|
||||
growth = get_growth_value( bill_types, bt )
|
||||
# factor in growth for next bills
|
||||
for yr in range( int(car_yr), END_YEAR+1 ):
|
||||
new_date=f"{yr}-{car_mmdd}"
|
||||
@@ -661,7 +660,7 @@ def recalcFutureBills():
|
||||
# deal with future bills due to their starting dates being dynamic
|
||||
amt=fb['amount']
|
||||
bt=fb['bill_type']
|
||||
growth=bill_types[bt]['ann_growth_simple']
|
||||
growth = get_growth_value( bill_types, bt )
|
||||
num_ann_bills= bf_id_num[bt_id_freq[bt]]
|
||||
if num_ann_bills == 1:
|
||||
# factor in growth for next bill
|
||||
|
||||
2
db.py
2
db.py
@@ -8,6 +8,8 @@ def connect_db(as_object):
|
||||
conn = sqlite3.connect('/data/finance.db')
|
||||
else:
|
||||
conn = sqlite3.connect('./finance.db')
|
||||
# allow deleting cset to clear our compare_to properly in finance table
|
||||
conn.execute("PRAGMA foreign_keys = ON;")
|
||||
if as_object:
|
||||
conn.row_factory = sqlite3.Row # This allows us to access columns by name
|
||||
return conn
|
||||
|
||||
16
main.py
16
main.py
@@ -41,7 +41,10 @@ def index():
|
||||
depletion_date=depletion_date.date(); # just show date
|
||||
|
||||
# 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'])
|
||||
if finance_data['compare_to']:
|
||||
COMP=get_comp_set_data(finance_data['compare_to'])
|
||||
else:
|
||||
COMP={}
|
||||
|
||||
DISP=[]
|
||||
# Row 1
|
||||
@@ -114,14 +117,18 @@ def index():
|
||||
|
||||
@app.route('/save', methods=['POST'])
|
||||
def save():
|
||||
insert_cset( request.get_json() )
|
||||
return "200"
|
||||
cset_id=insert_cset( request.get_json() )
|
||||
name = request.get_json()['vars']['name']
|
||||
return jsonify( cset_id=cset_id, name=name )
|
||||
|
||||
@app.route('/update', methods=['POST'])
|
||||
def update():
|
||||
|
||||
old_finance_data = get_finance_data()
|
||||
|
||||
raw_compare_to = request.form.get('compare_to')
|
||||
compare_to_value = None if raw_compare_to == "0" else int(raw_compare_to)
|
||||
|
||||
finance_data = (
|
||||
request.form['D_Salary'],
|
||||
request.form['D_Num_fortnights_pay'],
|
||||
@@ -147,9 +154,10 @@ def update():
|
||||
request.form['Mark_reno_date'],
|
||||
request.form['Car_buyout_date'],
|
||||
request.form['Sell_shares'],
|
||||
request.form['compare_to'],
|
||||
compare_to_value,
|
||||
request.form['Ioniq6_future']
|
||||
)
|
||||
|
||||
update_finance(finance_data)
|
||||
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
|
||||
|
||||
@@ -456,7 +456,7 @@
|
||||
function SaveTab( last_tab )
|
||||
{
|
||||
// set the drop-down for new bill to be this tab now...
|
||||
$("#new-bill-data-type").val( $('.nav-tabs .nav-link.active').prop('id').replace("tab-but-", "") )
|
||||
$("#new-bill-data-type").val( $('.nav-link.active').prop('id').replace("tab-but-", "") )
|
||||
$.ajax( { type: 'POST', url: '/saveui', contentType: 'application/json', data: JSON.stringify( { 'last_tab': last_tab } ), success: function() { } } )
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +230,12 @@
|
||||
$(function() { $('[data-bs-toggle="popover"]').popover(); });
|
||||
window.onload = function() {
|
||||
$('#Sell_shares').val( {{finance['Sell_shares']}} )
|
||||
$('#compare_to').val( {{finance['compare_to']}} )
|
||||
{% if finance['compare_to'] %}
|
||||
$('#compare_to').val( {{finance['compare_to']}} )
|
||||
{% else %}
|
||||
// set this to Nothing by default
|
||||
$('#compare_to').val( 0 )
|
||||
{% endif %}
|
||||
$('#Ioniq6_future').val( {{finance['Ioniq6_future']}} )
|
||||
|
||||
if( $("#Ioniq6_future option:selected"). text() == 'lease' )
|
||||
@@ -434,13 +439,17 @@
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-info"
|
||||
onClick="
|
||||
vars['name']=$('#save_name').val();
|
||||
$.ajax( {
|
||||
vars['name'] = $('#save_name').val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/save',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify( { 'vars': vars, 'savings_data' :savingsData } ),
|
||||
success: function() { $('#save_modal').modal('hide'); } } )"
|
||||
data: JSON.stringify({ 'vars': vars, 'savings_data': savingsData }),
|
||||
success: function(resp) {
|
||||
$('#save_modal').modal('hide');
|
||||
$('#compare_to').append($('<option>', { value: resp.cset_id, text: resp.name }));
|
||||
}
|
||||
});"
|
||||
>Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user