simple visual treatment of key dates

This commit is contained in:
2025-09-11 20:45:34 +10:00
parent 45d173e236
commit 4594630b9e
2 changed files with 24 additions and 4 deletions

View File

@@ -102,7 +102,8 @@ def index():
# now work out how much padding we need in the first year to align the last dates for all years # 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 padding=second_count - first_count
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 = 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)
@app.route('/save', methods=['POST']) @app.route('/save', methods=['POST'])
def save(): def save():

View File

@@ -99,19 +99,38 @@
<br> <br>
{% endfor %} {% endfor %}
{% set car_done=namespace( val=0 ) %}
{% for date, dollars in savings %} {% for date, dollars in savings %}
{% set yr=date[:4] %} {% set yr=date[:4] %}
{% set mon=date[5:7] %} {% set mon=date[5:7] %}
{% set day=date[8:10 ] %} {% set day=date[8:10 ] %}
{% set car_yr=key_dates['D_hyundai_owned'][:4] %}
{% set car_mon=key_dates['D_hyundai_owned'][5:7] %}
{% set car_day=key_dates['D_hyundai_owned'][8:10 ] %}
{% if yr|int > first_yr|int and mon == '01' and day|int <= 14 %} {% if yr|int > first_yr|int and mon == '01' and day|int <= 14 %}
</div><div class="col-auto"> </div><div class="col-auto">
<div class="pt-1 pb-1 mb-0 alert text-center bg-secondary text-light">{{yr}}</div> <div class="pt-1 pb-1 mb-0 alert text-center bg-secondary text-light">{{yr}}</div>
{% endif %} {% endif %}
{% if date == key_dates['D_quit_date'] %}
<font class="text-info">
<label data-bs-toggle="tooltip" title="D quits">
{% elif (yr == car_yr and mon == car_mon and day >= car_day and car_done.val == 0) %}
{%set car_done.val=1 %}
<font class="text-info">
<label data-bs-toggle="tooltip" title="We own car">
{% else %}
<font class="text-secondary"> <font class="text-secondary">
{{ date }}:&nbsp; <label>
{{ '$%0.2f' % dollars|float }}<br> {% endif %}
</font> {{ date }}:&nbsp;
{{ '$%0.2f' % dollars|float }}<br>
</label>
</font><br>
{% if comp_done.val == 0 and yr == comp_yr and mon == comp_mon and day|int >= comp_day|int %} {% if comp_done.val == 0 and yr == comp_yr and mon == comp_mon and day|int >= comp_day|int %}
<font class="text-info"> <font class="text-info">
{{ COMP['date'] }}:&nbsp; {{ COMP['date'] }}:&nbsp;