diff --git a/BUGS b/BUGS index d246701..cc83e5f 100644 --- a/BUGS +++ b/BUGS @@ -1,5 +1,3 @@ -* cannot remove bill type (Kayo) - OR (TODO): modify it to yearly from monthly - * can put in dumb dates - DO SOME INPUT VALIDATION, *sigh* - e.g. 0026-02-19 for a Gas bill diff --git a/db.py b/db.py index 68a232f..e4dff25 100644 --- a/db.py +++ b/db.py @@ -100,6 +100,7 @@ def init_db(): ann_growth_avg REAL, ann_growth_max REAL, ann_growth_simple REAL, + which_growth STRING, FOREIGN KEY(freq) REFERENCES bill_freq(id) )''') @@ -379,7 +380,7 @@ def insert_bill_type( bt, fq ): conn = connect_db(False) cur = conn.cursor() print( f"fq={fq}" ) - cur.execute( f"insert into bill_type ( 'name', 'freq', 'ann_growth_min', 'ann_growth_avg', 'ann_growth_max', 'ann_growth_simple' ) values ( '{bt}', {fq}, 0, 0, 0, 0 )" ) + cur.execute( f"insert into bill_type ( name, freq, ann_growth_min, ann_growth_avg, ann_growth_max, ann_growth_simple, which_growth ) values ( '{bt}', {fq}, 0, 0, 0, 0, 'cpi' )" ) conn.commit() conn.close() return @@ -403,6 +404,7 @@ def delete_bill(id): def delete_bill_type( id ): conn = connect_db(False) cur = conn.cursor() + cur.execute( f"delete from bill_data where bill_type = '{id}'" ) cur.execute( f"delete from bill_type where id = '{id}'" ) conn.commit() conn.close()