From e123fdaf49f9610393b607f2a43625f66e6bedc8 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Thu, 5 Mar 2026 16:58:57 +1100 Subject: [PATCH] fixed bug where we sell $0 of shares each year once we run out of shares --- BUGS | 2 -- calc.py | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BUGS b/BUGS index 958824e..d246701 100644 --- a/BUGS +++ b/BUGS @@ -1,5 +1,3 @@ -* if run out of shares, we still sell "$0" of them (annotation) - * cannot remove bill type (Kayo) - OR (TODO): modify it to yearly from monthly * can put in dumb dates - DO SOME INPUT VALIDATION, *sigh* diff --git a/calc.py b/calc.py index e6d303c..8108226 100644 --- a/calc.py +++ b/calc.py @@ -285,8 +285,10 @@ def calculate_savings_depletion(finance, bill_data, bill_type): D_CBA_shares -= 1 Sell_shares -= 1 - current_savings += actual_sell - add_annotation(finance, current_date, current_savings, actual_sell, "Sell shares" ) + # can run out, if so, no need to add :) + if actual_sell>0: + current_savings += actual_sell + add_annotation(finance, current_date, current_savings, actual_sell, "Sell shares" ) current_date += timedelta(days=1)